You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I upgraded the version used in our project from 4.1.31 to latest because I wanted to see how I could make use of the new sharding mechanism. As a side-note, the issue that made us think about parallelization is that we noticed that the tests run significantly longer the more of them we run; so we wanted to check how they run in parallel. But anyway, that's a different story for which I will probably open another issue.
When I re-ran the test suite after the upgrade the first test seems to be running as expected, however the following one fails with this error:
[PHPUnit\Framework\AssertionFailedError]
Client is not initialized
What do you get instead?
Full error output
In Assert.php line 2863:
[PHPUnit\Framework\AssertionFailedError]
Client is not initialized
Exception trace:
at /var/www/vendor/phpunit/phpunit/src/Framework/Assert.php:2863
PHPUnit\Framework\Assert::fail() at /var/www/vendor/codeception/lib-asserts/src/Codeception/Util/Shared/InheritedAsserts.php:1185
Codeception\Module->fail() at /var/www/vendor/codeception/module-symfony/src/Codeception/Module/Symfony.php:291
Codeception\Module\Symfony->getClient() at /var/www/vendor/codeception/module-symfony/src/Codeception/Module/Symfony/BrowserAssertionsTrait.php:30
Codeception\Module\Symfony->rebootClientKernel() at /var/www/tests/_support/Helper/MockedServiceContainer.php:75
App\Tests\Helper\MockedServiceContainer->restoreMockedServices() at /var/www/tests/_support/Helper/MockedServiceContainer.php:44
App\Tests\Helper\MockedServiceContainer->_after() at /var/www/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php:80
Codeception\Subscriber\Module->after() at /var/www/vendor/symfony/event-dispatcher/EventDispatcher.php:230
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() at /var/www/vendor/symfony/event-dispatcher/EventDispatcher.php:59
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /var/www/vendor/codeception/codeception/src/Codeception/Test/Test.php:291
Codeception\Test\Test->fire() at /var/www/vendor/codeception/codeception/src/Codeception/Test/Test.php:237
Codeception\Test\Test->realRun() at /var/www/vendor/codeception/codeception/src/Codeception/Suite.php:130
Codeception\Suite->run() at /var/www/vendor/codeception/codeception/src/Codeception/SuiteManager.php:148
Codeception\SuiteManager->run() at /var/www/vendor/codeception/codeception/src/Codeception/Codecept.php:260
Codeception\Codecept->runSuite() at /var/www/vendor/codeception/codeception/src/Codeception/Codecept.php:216
Codeception\Codecept->run() at /var/www/vendor/codeception/codeception/src/Codeception/Command/Run.php:646
Codeception\Command\Run->runSuites() at /var/www/vendor/codeception/codeception/src/Codeception/Command/Run.php:467
Codeception\Command\Run->execute() at /var/www/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Application.php:1040
Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:301
Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at /var/www/vendor/codeception/codeception/src/Codeception/Application.php:112
Codeception\Application->run() at /var/www/vendor/codeception/codeception/app.php:45
{closure}() at /var/www/vendor/codeception/codeception/app.php:46
require() at /var/www/vendor/codeception/codeception/codecept:7
include() at /var/www/vendor/bin/codecept:117
Details
Codeception version: 5.0.11
PHP Version: 8.1.23
Operating System: Ubuntu 22.04.03 LTS
Installation type: Composer
The text was updated successfully, but these errors were encountered:
I don't think that this error is directly related to upgrade to Codeception 5.
It happens in Symfony module and content of your App\Tests\Helper\MockedServiceContainer class may be very important.
Thanks for the fast reply @Naktibalda . I don't know how I missed the traces of MockedServiceContainer, I managed to discover what was causing that error.
However another strange behavior came up after fixing that one:
I have a test definition with the following details:
Feature file: And I have a product with price "1234.5678"
Implementation:
/**
* @Then I have a product with price :price
*/
public function theProductHasTheGivenPrice(float $price): void {...}
This used to work just fine with the previous version, and by that I mean that $price was correctly passed as float when the method was being called.
However after the update, it comes as string.
Argument #1 ($price) must be of type float, string given, called in /var/www/vendor/codeception/codeception/src/Codeception/Test/Gherkin.php on line 185
I've looked up if there are ways to specify in the feature file that I want value X to represent a float, but I haven't found anything along those lines. I'm not sure if the behaviour of the previous version where the value was type-casted was intended or not. Have you encountered this before ?
What are you trying to achieve?
Hello,
I upgraded the version used in our project from 4.1.31 to latest because I wanted to see how I could make use of the new sharding mechanism. As a side-note, the issue that made us think about parallelization is that we noticed that the tests run significantly longer the more of them we run; so we wanted to check how they run in parallel. But anyway, that's a different story for which I will probably open another issue.
When I re-ran the test suite after the upgrade the first test seems to be running as expected, however the following one fails with this error:
What do you get instead?
Full error output
Details
The text was updated successfully, but these errors were encountered: