Closed aminkt closed 6 years ago
Is there any suggestions?
No. @SamMousa would you please take a look?
No idea..
@SamMousa @samdark
I reinstalled app and when configured tests by https://github.com/yiisoft/yii2-app-advanced/blob/2.0.14/docs/guide/start-testing.md.
Then when i run vendor/bin/codecept run
.
This time i don't use mongo db.
Codeception PHP Testing Framework v2.4.5
Powered by PHPUnit 7.2.7 by Sebastian Bergmann and contributors.
[common\tests]: tests from /var/www/core/common
Common\tests.unit Tests (3) --------------------------------------------------------------------------------------------------------------------------------------------------
✔ LoginFormTest: Login no user (0.28s)
E LoginFormTest: Login wrong password
E LoginFormTest: Login wrong password (0.03s)
In Yii2.php line 346:
Undefined property: Codeception\Module\Yii2::$connectionWatcher
run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--coverage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--] [<suite> [<test>]]
PHP Fatal error: Uncaught RuntimeException: Command Did Not Finish Properly in /var/www/vendor/codeception/base/src/Codeception/Subscriber/ErrorHandler.php:101
Stack trace:
#0 [internal function]: Codeception\Subscriber\ErrorHandler->shutdownHandler()
#1 {main}
thrown in /var/www/vendor/codeception/base/src/Codeception/Subscriber/ErrorHandler.php on line 101
I using one of forks of advanced-template : http://github.com/aminkt/yii2-app-api
I think problem come from this:
Undefined property: Codeception\Module\Yii2::$connectionWatcher
Codeception PHP Testing Framework v2.4.5
Install the latest version of Codeception.
I update codeception to v2.4.5 and the same thing happend.
root@709f36529dd8:/var/www/core# ../vendor/bin/codecept run -c common unit
Codeception PHP Testing Framework v2.5.1
Powered by PHPUnit 7.3.5 by Sebastian Bergmann and contributors.
Running with seed:
Common\tests.unit Tests (3) --------------------------------------------------------------------------------------------------------------------------------------------------
✔ LoginFormTest: Login no user (0.21s)
E LoginFormTest: Login wrong password
E LoginFormTest: Login wrong password (0.01s)
E LoginFormTest: Login correct
E LoginFormTest: Login correct (0.00s)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 1.89 seconds, Memory: 6.00MB
There were 4 errors:
---------
1) LoginFormTest: Login wrong password
Test tests/unit/models/LoginFormTest.php:testLoginWrongPassword
[yii\base\InvalidConfigException] The configuration for the "db" component must contain a "class" element.
#1 /var/www/vendor/yiisoft/yii2/di/ServiceLocator.php:205
#2 /var/www/vendor/yiisoft/yii2/di/ServiceLocator.php:261
#3 /var/www/vendor/yiisoft/yii2/base/Component.php:180
#4 /var/www/vendor/yiisoft/yii2/BaseYii.php:546
#5 /var/www/vendor/yiisoft/yii2/base/BaseObject.php:107
#6 /var/www/vendor/yiisoft/yii2/base/Application.php:206
#7 yii\base\Application->__construct
#8 /var/www/vendor/yiisoft/yii2/di/Container.php:383
#9 /var/www/vendor/yiisoft/yii2/di/Container.php:156
#10 /var/www/vendor/yiisoft/yii2/BaseYii.php:349
---------
2) LoginFormTest: Login wrong password
Test tests/unit/models/LoginFormTest.php:testLoginWrongPassword
[yii\base\InvalidConfigException] Unknown component ID: i18n
#1 /var/www/vendor/yiisoft/yii2/di/ServiceLocator.php:139
#2 /var/www/vendor/yiisoft/yii2/base/Module.php:742
#3 /var/www/vendor/yiisoft/yii2/base/Application.php:580
#4 /var/www/vendor/yiisoft/yii2/BaseYii.php:526
#5 /var/www/vendor/yiisoft/yii2/validators/RequiredValidator.php:60
#6 /var/www/vendor/yiisoft/yii2/base/BaseObject.php:109
#7 yii\base\BaseObject->__construct
#8 /var/www/vendor/yiisoft/yii2/di/Container.php:383
#9 /var/www/vendor/yiisoft/yii2/di/Container.php:156
#10 /var/www/vendor/yiisoft/yii2/BaseYii.php:349
---------
3) LoginFormTest: Login correct
Test tests/unit/models/LoginFormTest.php:testLoginCorrect
[yii\base\InvalidConfigException] The configuration for the "db" component must contain a "class" element.
#1 /var/www/vendor/yiisoft/yii2/di/ServiceLocator.php:205
#2 /var/www/vendor/yiisoft/yii2/di/ServiceLocator.php:261
#3 /var/www/vendor/yiisoft/yii2/base/Component.php:180
#4 /var/www/vendor/yiisoft/yii2/BaseYii.php:546
#5 /var/www/vendor/yiisoft/yii2/base/BaseObject.php:107
#6 /var/www/vendor/yiisoft/yii2/base/Application.php:206
#7 yii\base\Application->__construct
#8 /var/www/vendor/yiisoft/yii2/di/Container.php:383
#9 /var/www/vendor/yiisoft/yii2/di/Container.php:156
#10 /var/www/vendor/yiisoft/yii2/BaseYii.php:349
---------
4) LoginFormTest: Login correct
Test tests/unit/models/LoginFormTest.php:testLoginCorrect
[yii\base\InvalidConfigException] Unknown component ID: i18n
#1 /var/www/vendor/yiisoft/yii2/di/ServiceLocator.php:139
#2 /var/www/vendor/yiisoft/yii2/base/Module.php:742
#3 /var/www/vendor/yiisoft/yii2/base/Application.php:580
#4 /var/www/vendor/yiisoft/yii2/BaseYii.php:526
#5 /var/www/vendor/yiisoft/yii2/validators/RequiredValidator.php:60
#6 /var/www/vendor/yiisoft/yii2/base/BaseObject.php:109
#7 yii\base\BaseObject->__construct
#8 /var/www/vendor/yiisoft/yii2/di/Container.php:383
#9 /var/www/vendor/yiisoft/yii2/di/Container.php:156
#10 /var/www/vendor/yiisoft/yii2/BaseYii.php:349
ERRORS!
Tests: 3, Assertions: 2, Errors: 4.
root@709f36529dd8:/var/www/core#
@aminkt, have you read the error message?
[yii\base\InvalidConfigException] The configuration for the "db" component must contain a "class" element.
Does your database configuration have a class
key?
For mongo db i did but in new app not. let me check
@SamMousa New error message is:
Output path is not defined by key "paths: output"
Sorry, I'm have run out of patience and will no longer be spending time on this issue. Please stop tagging people with @. I will unsubscribe from this issue; good luck with figuring out a solution!
Problem solved.
I used required_onc
to include my db conf and for second running test cause problem.
Sorry for wasting your time.
On old project to fix run tests
Output path is not defined by key "paths: output"
need fix and update version in composer.json from * to "codeception/module-yii2": "1.0.1",
What steps will reproduce the problem?
I created a test class like below:
My codeception configuration file is like below:
And my unit suit configuration file is like this:
What is the expected result?
When i run command like
codecept -c common run unit models/DeveloperTest --steps --debug -vvv
all tests should be run and pass.What do you get instead?
I got below errors that say
mongodb
andi18n
component not configured. This problem happen in second test function running liketestSave
andtestUpdate
inDeveloperTest
class.First method run correctly.
Additional info