"You cannot define a display element when in sequence" when running phpunit in symfony

I get the following errors when I try to run phpunit in my symfony project:

$ phpunit -c app 1) [...]\DefaultControllerTest::testIndex Symfony\Component\Config\Exception\FileLoaderLoadException: Cannot import resource "/srv/http/typeform/app/config/config.yml" from "/srv/http/typeform/app/config/config_dev.yml". /srv/http/typeform/vendor/symfony/src/Symfony/Component/Config/Loader/FileLoader.php:89 [...] /srv/http/typeform/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:39 /srv/http/typeform/src/QuickyForm/PublicBundle/Tests/Controller/DefaultControllerTest.php:11 Caused by Symfony\Component\Yaml\Exception\ParseException: You cannot define a mapping item when in a sequence in "\/srv\/http\/typeform\/app\/config\/config.yml" /usr/share/pear/Symfony/Component/Yaml/Parser.php:116 [...] /srv/http/typeform/app/bootstrap.php.cache:520 /srv/http/typeform/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:39 /srv/http/typeform/src/QuickyForm/PublicBundle/Tests/Controller/DefaultControllerTest.php:11 

It seems to crash when I call static::createClient();

Here is my config_test.yml

 imports: - { resource: config_dev.yml } 
+4
source share
1 answer

The errors you get indicate that the application is not parsing your "config.yml" because "you cannot determine the display element in the sequence."

This means that in the yml file when defining array values ​​you cannot provide both matching records in the "key: value" form and sequence entries in the "- element" form - all values ​​must be either one or the other.

So this is normal:

 group: key: value key: value 

This is also normal:

 group: - item - item 

It is not normal:

 group: key: value - item 

Errors suggest the presence of the latter form in your config.yml, although if so, this should cause problems with the launch of your application in the browser, and not just under phpunit.

+12
source

Source: https://habr.com/ru/post/1480111/


All Articles