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
Any Actions with a return type specified will throw:
PHP Fatal error: Uncaught TypeError: FunctionalTester::haveInDatabase(): Return value must be of type int, Codeception\Util\Maybe returned in ... tests/_support/_generated/FunctionalTesterActions.php:91
command
vendor/bin/codecept dry-run functional
result
Functional Tests (1) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modules: \Helper\Functional, Db, \First4Figures\Magento\Codeception\Helper\Magento\Driver, \First4Figures\Magento\Codeception\Helper\Magento
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TestCest: Test
Signature: TestCest:Test
Test: tests/functional/TestCest.php:Test
Scenario --
I have in database "x",[]
PHP Fatal error: Uncaught TypeError: FunctionalTester::haveInDatabase(): Return value must be of type int, Codeception\Util\Maybe returned in /mnt/d/Projects/vc2/mage/001.www/tests/_support/_generated/FunctionalTesterActions.php:91
tests/_support/_generated/FunctionalTesterActions.php (excerpt: return $this-> ... is on line 91)
/** * [!] Method is generated. Documentation taken from corresponding module. * * Inserts an SQL record into a database. This record will be erased after the test. * * ```php * <?php * $I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com')); * ``` * @see \Codeception\Module\Db::haveInDatabase() */publicfunctionhaveInDatabase(string$table, array$data): int {
return$this->getScenario()->runStep(new \Codeception\Step\Action('haveInDatabase', func_get_args()));
}
Details
Codeception version: 4.1.29
PHP Version: 8.1.5
Operating System: ubuntu on window subsystem for linux
Installation type: Composer
The text was updated successfully, but these errors were encountered:
Thank you for the feedback.
In truth the codeception/module-db was just an example, this behavior happens for any Action with return value.
In my opinion the intrinsic problem is that it does not make sense to return value during a dry-run.
However this would prevent the code to run as it throws errors.
A way to fix it would be to modify the template that generate the code above to return a default value for each type (e.g. false for bool, 0 for int etc.) if actual Action returns a Codeception\Util\Maybe.
What are you trying to achieve?
Dryrun my tests
What do you get instead?
Any Actions with a return type specified will throw:
PHP Fatal error: Uncaught TypeError: FunctionalTester::haveInDatabase(): Return value must be of type int, Codeception\Util\Maybe returned in ... tests/_support/_generated/FunctionalTesterActions.php:91
Details
The text was updated successfully, but these errors were encountered: