We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to add multiple dependencies to a test.
An error occurs due to string (single dependency) vs. array (multiple dependencies) type mismatch.
string
array
Provide console output if related. Use -vvv mode for more details.
-vvv
$ codecept run <suite> FooCest Codeception PHP Testing Framework v5.0.10 https://helpukrainewin.org/ Fatal error: Uncaught TypeError: str_contains(): Argument #1 ($haystack) must be of type string, array given in /.../vendor/codeception/codeception/src/Codeception/Test/Cest.php:246 Stack trace: #0 /.../vendor/codeception/codeception/src/Codeception/Test/Cest.php(246): str_contains(Array, ':') #1 /.../vendor/codeception/codeception/src/Codeception/Suite.php(159): Codeception\Test\Cest->fetchDependencies() #2 /.../vendor/codeception/codeception/src/Codeception/Suite.php(138): Codeception\Suite->getDependencies(Object(Codeception\Test\Cest)) #3 /.../vendor/codeception/codeception/src/Codeception/SuiteManager.php(93): Codeception\Suite->reorderDependencies() #4 /.../vendor/codeception/codeception/src/Codeception/Codecept.php(258): Codeception\SuiteManager->loadTests('FooCest') #5 /.../vendor/codeception/codeception/src/Codeception/Codecept.php(216): Codeception\Codecept->runSuite(Array, '<suite>', 'FooCest') #6 /.../vendor/codeception/codeception/src/Codeception/Command/Run.php(435): Codeception\Codecept->run('<suite>', 'FooCest', Array) #7 /.../vendor/symfony/console/Command/Command.php(326): Codeception\Command\Run->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /.../vendor/symfony/console/Application.php(1063): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /.../vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Codeception\Command\Run), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /.../vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /.../vendor/codeception/codeception/src/Codeception/Application.php(112): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 /.../vendor/codeception/codeception/app.php(45): Codeception\Application->run() #13 /.../vendor/codeception/codeception/app.php(46): {closure}() #14 /.../vendor/codeception/codeception/codecept(7): require('/.../v...') #15 /.../vendor/bin/codecept(119): include('/.../v...') #16 {main} thrown in /.../vendor/codeception/codeception/src/Codeception/Test/Cest.php on line 246 PHP Fatal error: Uncaught TypeError: str_contains(): Argument #1 ($haystack) must be of type string, array given in /.../vendor/codeception/codeception/src/Codeception/Test/Cest.php:246
Provide test source code if related
use Codeception\Attribute\Depends; final class FooCest { public function testFirst (): void { } public function testSecond (): void { } #[Depends('testFirst')] #[Depends('testSecond')] public function testThird (): void { } }
composer show
# paste suite config here
The text was updated successfully, but these errors were encountered:
Allow multiple test dependencies
9a87796
The Depends attribute can be added multiple times to tests now to indicate dependencies on various other tests. Fixes Codeception#6675
0eeb765
Successfully merging a pull request may close this issue.
What are you trying to achieve?
I want to add multiple dependencies to a test.
What do you get instead?
An error occurs due to
string
(single dependency) vs.array
(multiple dependencies) type mismatch.Details
composer show
)# paste suite config here
The text was updated successfully, but these errors were encountered: