Please post full stacktrace. A way to reproduce it would be helpful as well.
i am using yii2 2.0.10 (advanced template) and codeception 2.2.6
built test cases using command composer exec codecept build
this code generated -
Included Configuration: common
Building Actor classes for suites: unit
-> UnitTesterActions.php generated successfully. 0 methods added
common\tests\UnitTester includes modules: Yii2
Included Configuration: frontend
Building Actor classes for suites: functional, unit, acceptance
-> FunctionalTesterActions.php generated successfully. 0 methods added
frontend\tests\FunctionalTester includes modules: Filesystem, Yii2
-> UnitTesterActions.php generated successfully. 0 methods added
frontend\tests\UnitTester includes modules: Yii2, Asserts
-> AcceptanceTesterActions.php generated successfully. 0 methods added
frontend\testsAcceptanceTester includes modules: WebDriver, Yii2
Included Configuration: backend
Building Actor classes for suites: functional, unit
-> FunctionalTesterActions.php generated successfully. 0 methods added
backend\tests\FunctionalTester includes modules: Yii2
-> UnitTesterActions.php generated successfully. 0 methods added
backend\tests\UnitTester includes modules:
Building Actor classes for suites: functional, unit
-> FunctionalTesterActions.php generated successfully. 0 methods added
backend\tests\FunctionalTester includes modules: Yii2
-> UnitTesterActions.php generated successfully. 0 methods added
backend\tests\UnitTester includes modules:
then run tests using composer exec codecept run acceptance -- -c frontend
got this
Frontend\tests.acceptance Tests (1) ------------------------------------------
E HomeCest: Check home
PHP Fatal error: Call to a member function resetPersistentVars() on a non-object in /var/www/html/phpcodelib/vendor/codeception/codeception/src/Codeception/Module/Yii2.php on line 195
FATAL ERROR. TESTS NOT FINISHED.
Call to a member function resetPersistentVars() on a non-object
in /var/www/html/phpcodelib/vendor/codeception/codeception/src/Codeception/Module/Yii2.php:195
Is you application template recent or created using older Yii version?
Looks like you have conflicts between different Codeception versions.
If you look at Codeception/Module/Yii2 there is nothing like resetPersistentVars() on line 195.
So you are using older Codeception version there. Please check you don't keep older Codeception globally installed or somewhere else.
codecept in global C:\codecept... last master version.
{
"minimum-stability" : "stable",
"require": {
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1",
"facebook/webdriver": "^1.0.1",
"codeception/specify": "*"
}
}
I also could not run the test yesterday.
D:\projects\metering\yii2-app-advanced\backend (master)
codecept run acceptance
HomeCest: Check home
PHP Fatal error: Uncaught Error: Call to a member function resetPersistentVars() on null in C:\codecept\vendor\codeception\base\src\Codeception\Module\Yii2.php:195
Stack trace:
#0 C:\codecept\vendor\codeception\base\src\Codeception\Subscriber\Module.php(68): Codeception\Module\Yii2->_after(Object(Codeception\Test\Cest))
#1 [internal function]: Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 C:\codecept\vendor\symfony\event-dispatcher\EventDispatcher.php(174): call_user_func(Array, Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 C:\codecept\vendor\symfony\event-dispatcher\EventDispatcher.php(43): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'test.after', Object(Codeception\Event\TestEvent))
#4 C:\codecept\vendor\codeception\base\src\Codeception\PHPUnit\Listener.php(124): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('test.aft in C:\codecept\vendor\codeception\base\src\Codeception\Module\Yii2.php on line 195
Fatal error: Uncaught Error: Call to a member function resetPersistentVars() on null in C:\codecept\vendor\codeception\base\src\Codeception\Module\Yii2.php:195
Stack trace:
#0 C:\codecept\vendor\codeception\base\src\Codeception\Subscriber\Module.php(68): Codeception\Module\Yii2->_after(Object(Codeception\Test\Cest))
#1 [internal function]: Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 C:\codecept\vendor\symfony\event-dispatcher\EventDispatcher.php(174): call_user_func(Array, Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 C:\codecept\vendor\symfony\event-dispatcher\EventDispatcher.php(43): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'test.after', Object(Codeception\Event\TestEvent))
#4 C:\codecept\vendor\codeception\base\src\Codeception\PHPUnit\Listener.php(124): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('test.aft in C:\codecept\vendor\codeception\base\src\Codeception\Module\Yii2.php on line 195
FATAL ERROR. TESTS NOT FINISHED.
Uncaught Error: Call to a member function resetPersistentVars() on null in C:\codecept\vendor\codeception\base\src\Codeception\Module\Yii2.php:195
Stack trace:
#0 C:\codecept\vendor\codeception\base\src\Codeception\Subscriber\Module.php(68): Codeception\Module\Yii2->_after(Object(Codeception\Test\Cest))
#1 [internal function]: Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 C:\codecept\vendor\symfony\event-dispatcher\EventDispatcher.php(174): call_user_func(Array, Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 C:\codecept\vendor\symfony\event-dispatcher\EventDispatcher.php(43): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'test.after', Object(Codeception\Event\TestEvent))
#4 C:\codecept\vendor\codeception\base\src\Codeception\PHPUnit\Listener.php(124): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('test.aft
in C:\codecept\vendor\codeception\base\src\Codeception\Module\Yii2.php:195
it is recently created application template, i changed codeception/base to codeception/codeception in composer.json file then run tests
if there is conflict between codeception versions then how can i remove it globally and install fresh full version of it
@DavertMik https://github.com/Codeception/Codeception/blob/2.2.6/src/Codeception/Module/Yii2.php#L195
I can't imagine how $this->client could be unset in _after.
just adjust your browser setting in acceptance.suite.yml, I solved this problem by change the default browser from firefox to chrome.
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: http://localhost:8080
browser: chrome
- Yii2:
part: init
Fatal error: Uncaught Error: Call to a member function stop() on null in D:\wamp64\www\basic1\vendor\codeception\base\src\Codeception\Module\Yii2.php:346
Stack trace:
This is a completely new Yii project. nobody other code.
only vender/bin/codecept run acceptance
I need some help。
yii2 version "yiisoft/yii2": "~2.0.14",
packages version
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1",
"codeception/specify": "~0.4.3",
"codeception/codeception": "^2.4"
acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: http://localhost:8080/
browser: chrome
- Yii2:
part: orm
entryScript: index-test.php
cleanup: false
extensions:
enabled:
- Codeception\Extension\RunProcess:
0: java -jar D:\wamp64\selenium-server-standalone.jar
1: php D:\wamp64\www\basic1\yii serve
sleep: 5
@wulove52 Please how did you solve this issue "Fatal error: Uncaught Error: Call to a member function stop() on null in D:\wamp64\www\basic1\vendor\codeception\base\src\Codeception\Module\Yii2.php:346"
Most helpful comment
it is recently created application template, i changed codeception/base to codeception/codeception in composer.json file then run tests