First run return error. Second run is ok.
https://yadi.sk/i/GOZkQctX3TBfEZ
List of installed packages (composer show)
beberlei/assert v2.9.2 Thin assertion libra...
behat/gherkin v4.5.1 Gherkin DSL parser f...
codeception/codeception 2.4.0 BDD-style testing fr...
codeception/phpunit-wrapper 7.0.2 PHPUnit classes used...
codeception/stub 1.0.2 Flexible Stub wrappe...
doctrine/annotations v1.6.0 Docblock Annotations...
doctrine/cache v1.7.1 Caching library offe...
doctrine/collections v1.5.0 Collections Abstract...
doctrine/common v2.8.1 Common Library for D...
doctrine/data-fixtures v1.3.0 Data Fixtures for al...
doctrine/dbal dev-master 3bfaa82 Database Abstraction...
doctrine/doctrine-bundle 1.8.1 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.2 Symfony Bundle for D...
doctrine/doctrine-fixtures-bundle 3.0.2 Symfony DoctrineFixt...
doctrine/doctrine-migrations-bundle v1.3.1 Symfony DoctrineMigr...
doctrine/inflector v1.3.0 Common String Manipu...
doctrine/instantiator 1.1.0 A small, lightweight...
doctrine/lexer v1.0.1 Base library for a l...
doctrine/migrations v1.6.2 Database Schema migr...
doctrine/orm 2.7.x-dev 4f6d47b Object-Relational-Ma...
egulias/email-validator 2.1.3 A library for valida...
facebook/webdriver 1.5.0 A PHP client for Sel...
flow/jsonpath 0.3.4 JSONPath implementat...
guzzlehttp/guzzle 6.3.0 Guzzle is a PHP HTTP...
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.4.2 PSR-7 message implem...
jdorn/sql-formatter v1.2.17 a PHP SQL highlighti...
monolog/monolog 1.23.0 Sends your logs to f...
myclabs/deep-copy 1.7.0 Create deep copies (...
nelmio/cors-bundle 1.5.4 Adds CORS (Cross-Ori...
ocramius/package-versions 1.3.0 Composer plugin that...
ocramius/proxy-manager 2.2.0 A library providing ...
paragonie/random_compat v2.0.11 PHP 5.x polyfill for...
phar-io/manifest 1.0.1 Component for readin...
phar-io/version 1.0.1 Library for handling...
phpdocumentor/reflection-common 1.0.1 Common reflection cl...
phpdocumentor/reflection-docblock 4.3.0 With this component,...
phpdocumentor/type-resolver 0.4.0
phpspec/prophecy 1.7.5 Highly opinionated m...
phpunit/php-code-coverage 6.0.1 Library that provide...
phpunit/php-file-iterator 1.4.5 FilterIterator imple...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 2.0.0 Utility class for ti...
phpunit/php-token-stream 3.0.0 Wrapper around PHP's...
phpunit/phpunit 7.0.2 The PHP Unit Testing...
phpunit/phpunit-mock-objects 6.0.1 Mock Object library ...
psr/cache 1.0.1 Common interface for...
psr/container 1.0.0 Common Container Int...
psr/http-message 1.0.1 Common interface for...
psr/log 1.0.2 Common interface for...
psr/simple-cache 1.0.0 Common interfaces fo...
ramsey/uuid 3.7.3 Formerly rhumsaa/uui...
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which funct...
sebastian/comparator 2.1.3 Provides the functio...
sebastian/diff 3.0.0 Diff implementation
sebastian/environment 3.1.0 Provides functionali...
sebastian/exporter 3.1.0 Provides the functio...
sebastian/global-state 2.0.0 Snapshotting of glob...
sebastian/object-enumerator 3.0.3 Traverses array stru...
sebastian/object-reflector 1.1.1 Allows reflection of...
sebastian/recursion-context 3.0.0 Provides functionali...
sebastian/resource-operations 1.0.0 Provides a list of P...
sebastian/version 2.0.1 Library that helps w...
sensio/framework-extra-bundle v5.1.6 This bundle provides...
swiftmailer/swiftmailer v6.0.2 Swiftmailer, free fe...
symfony/browser-kit v4.0.5 Symfony BrowserKit C...
symfony/cache v4.0.5 Symfony Cache compon...
symfony/config v4.0.5 Symfony Config Compo...
symfony/console v4.0.5 Symfony Console Comp...
symfony/css-selector v4.0.5 Symfony CssSelector ...
symfony/debug v4.0.5 Symfony Debug Component
symfony/dependency-injection v4.0.5 Symfony DependencyIn...
symfony/doctrine-bridge v4.0.5 Symfony Doctrine Bridge
symfony/dom-crawler v4.0.5 Symfony DomCrawler C...
symfony/dotenv v4.0.5 Registers environmen...
symfony/event-dispatcher v4.0.5 Symfony EventDispatc...
symfony/expression-language v4.0.5 Symfony ExpressionLa...
symfony/filesystem v4.0.5 Symfony Filesystem C...
symfony/finder v4.0.5 Symfony Finder Compo...
symfony/flex v1.0.70
symfony/framework-bundle v4.0.5 Symfony FrameworkBundle
symfony/http-foundation v4.0.5 Symfony HttpFoundati...
symfony/http-kernel v4.0.5 Symfony HttpKernel C...
symfony/inflector v4.0.5 Symfony Inflector Co...
symfony/lts dev-master 396c5fc Enforces Long Term S...
symfony/maker-bundle v1.1.1 Symfony Maker helps ...
symfony/monolog-bridge v4.0.5 Symfony Monolog Bridge
symfony/monolog-bundle v3.1.2 Symfony MonologBundle
symfony/orm-pack v1.0.5 A pack for the Doctr...
symfony/polyfill-mbstring v1.7.0 Symfony polyfill for...
symfony/polyfill-php72 v1.7.0 Symfony polyfill bac...
symfony/process v4.0.5 Symfony Process Comp...
symfony/profiler-pack v1.0.3 A pack for the Symfo...
symfony/property-access v4.0.5 Symfony PropertyAcce...
symfony/property-info v4.0.5 Symfony Property Inf...
symfony/routing v4.0.5 Symfony Routing Comp...
symfony/security v4.0.5 Symfony Security Com...
symfony/security-bundle v4.0.5 Symfony SecurityBundle
symfony/serializer v4.0.5 Symfony Serializer C...
symfony/serializer-pack v1.0.1 A pack for the Symfo...
symfony/stopwatch v4.0.5 Symfony Stopwatch Co...
symfony/swiftmailer-bundle v3.2.0 Symfony SwiftmailerB...
symfony/translation v4.0.5 Symfony Translation ...
symfony/twig-bridge v4.0.5 Symfony Twig Bridge
symfony/twig-bundle v4.0.5 Symfony TwigBundle
symfony/validator v4.0.5 Symfony Validator Co...
symfony/var-dumper v4.0.5 Symfony mechanism fo...
symfony/web-profiler-bundle v4.0.5 Symfony WebProfilerB...
symfony/yaml v4.0.5 Symfony Yaml Component
theseer/tokenizer 1.1.0 A small library for ...
twig/extensions v1.5.1 Common additional fe...
twig/twig v2.4.6 Twig, the flexible, ...
webmozart/assert 1.3.0 Assertions to valida...
zendframework/zend-code 3.3.0 provides facilities ...
zendframework/zend-eventmanager 3.2.0 Trigger and listen t...
zircote/swagger-php 2.0.13 Swagger-PHP - Genera...
Suite configuration:
actor: UnitTester
modules:
enabled:
- Symfony2:
app_path: 'src'
var_path: 'var'
environment: 'dev'
- Doctrine2:
depends: Symfony2
cleanup: true
- Asserts
- \App\Tests\Helper\Unit
Actual for all tests.
Please provide error output as a text, not as a screenshot.
anton@mac:~/Documents/work/bizon/server$ ./codecept "run api EntityCest:tryRemove" manager
Codeception PHP Testing Framework v2.4.0
Powered by PHPUnit 7.0.2 by Sebastian Bergmann and contributors.
App\Tests.api Tests (1) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
E EntityCest: Try remove
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 24.61 seconds, Memory: 40.25MB
There was 1 error:
---------
1) EntityCest: Try remove
Test tests/api/EntityCest.php:tryRemove
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] The "doctrine" service is already initialized, you cannot replace it.
#1 /var/www/manager/vendor/symfony/dependency-injection/Container.php:165
#2 /var/www/manager/vendor/symfony/event-dispatcher/EventDispatcher.php:212
#3 /var/www/manager/vendor/symfony/event-dispatcher/EventDispatcher.php:44
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
anton@mac:~/Documents/work/bizon/server$ ./codecept "run api EntityCest:tryRemove" manager
Codeception PHP Testing Framework v2.4.0
Powered by PHPUnit 7.0.2 by Sebastian Bergmann and contributors.
App\Tests.api Tests (1) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
✔ EntityCest: Try remove (5.46s)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 8.26 seconds, Memory: 36.00MB
OK (1 test, 10 assertions)
Has anybody solved this issue? I tried but without success
We had the same issue in our project. Test were failing in CI builds, and in dev envs it was OK because we had cached warmup after first run. Maybe it's not the clearest sollution but we added
bin/console cache:warmup --no-debug
line to our test-run script and now first run works well.
If anyone having issues with the workaround posted above. Make sure you configure your symfony module with debug set to false(it's true by default)
I can confirm that the solution of @IAmJahoo works, tested with codeception 2.4.2, PHP 7.2.6 and Symfony 4.1. However I didn't need the --no-debug flag set.
Setting debug to false as suggested by @Tawp works too but has it's up and down sides. Tests will probably run faster but can make debugging harder.
edit: Okay, for some reason just clearing the cache (with or without no-debug) doesn't work anymore. Most reliable way is to disable debug when running tests until this bug is fixed.
Some workarounds were proposed in comments
Most helpful comment
We had the same issue in our project. Test were failing in CI builds, and in dev envs it was OK because we had cached warmup after first run. Maybe it's not the clearest sollution but we added
bin/console cache:warmup --no-debugline to our test-run script and now first run works well.