-1

我们对捆绑包https://github.com/liip/LiipTestFixturesBundle/tree/2.x有问题(请注意,我是该捆绑包的维护者之一,问题不在于在项目中使用该捆绑包)

2.x分支上的测试因以下错误而中断:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:服务“nelmio_alice.property_accessor.std”依赖于不存在的服务“property_accessor”。你的意思是:“nelmio_alice.property_accessor.std”?

以下是该服务的声明方式vendor/nelmio/alice/src/Bridge/Symfony/Resources/config/property_access.xml

        <service id="nelmio_alice.property_accessor.std"
                 class="Nelmio\Alice\PropertyAccess\StdPropertyAccessor">
           <argument type="service" id="property_accessor" />
        </service>

应该调用此代码,因为NelmioAliceBundle它是在AppKernel.

因此,我们将其添加composer.json禁止symfony/property-access 5.3并修复了错误:

"symfony/property-access": "^4.4 || ^5.0 , <5.3",

但是,如果我们删除该解决方法,它会再次中断。而且我不明白是什么导致了这个问题。

禁止symfony/framework-bundle5.3 也解决了这个问题:https ://github.com/liip/LiipTestFixturesBundle/pull/127/commits/a534419e61ef90ca2685d697b89b2ce225712cdc


property_accessor当我们使用symfony/framework-bundle5.3 或5.3 时,是什么导致了缺失symfony/property-access


如何复制错误

git clone git@github.com:liip/LiipTestFixturesBundle.git
cd LiipTestFixturesBundle
git checkout remove-required-symfony/property-access
composer install
vendor/bin/phpunit --testdox tests/Test/ConfigEventsTest.php
4

1 回答 1

0

添加property_access: ~framework配置中修复了问题(commit)。

未配置时,该服务似乎丢失了。


这个问题在全新的 Symfony 安装中重现:

$ bin/console debug:container property_accessor
[critical] Error thrown while running command "debug:container property_accessor". Message: "No services found that match "property_accessor"."

                                                     
  No services found that match "property_accessor".  

如果你也有这个问题,运行composer require symfony/property-access.

于 2021-06-17T18:15:07.587 回答