-
create yii2-basic template application
-
run test
$ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
$ composer global require "codeception/codeception=2.0.*"
$ composer global require "codeception/specify=*"
$ composer global require "codeception/verify=*"
$ cd basic/tests
$ ../vendor/bin/codecept run -------------- run all test cases.
result as follows:
Codeception PHP Testing Framework v2.1.2
Powered by PHPUnit 4.8.6 by Sebastian Bergmann and contributors.
Functional Tests (4) -------------------------------------------------------------------------------------------------------------------------
Ensure that about works (AboutCept) Ok
Ensure that contact works (ContactCept) Ok
Ensure that home page works (HomeCept) Ok
Ensure that login works (LoginCept) Ok
----------------------------------------------------------------------------------------------------------------------------------------------
Acceptance Tests (4) -------------------------------------------------------------------------------------------------------------------------
Ensure that about works (AboutCept) Ok
Ensure that contact works (ContactCept) Ok
Ensure that home page works (HomeCept) Ok
Ensure that login works (LoginCept) Ok
----------------------------------------------------------------------------------------------------------------------------------------------
Unit Tests (4) ----------------------------------------------------------------------------------------------------------------------------------
Test contact (tests\codeception\unit\models\ContactFormTest::testContact) Ok
Test login no user (tests\codeception\unit\models\LoginFormTest::testLoginNoUser) Ok
Test login wrong password (tests\codeception\unit\models\LoginFormTest::testLoginWrongPassword) Ok
Trying to test login correct (tests\codeception\unit\models\LoginFormTest::testLoginCorrect)... PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in /home/workspace/basic/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php on line 121
<pre>PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes)'
in /home/workspace/basic/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php:121
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
Obviously unit test got something wrong, out of memory
however, if I run unit test directly,
$cd tests
$ ../vendor/bin/codecept run unit -------------------- only run unit tests
Unit test can pass. WHY is this happen?
Codeception PHP Testing Framework v2.1.2
Powered by PHPUnit 4.8.6 by Sebastian Bergmann and contributors.
Unit Tests (4) ----------------------------------------------------------------------------------------------------------------------------------
Test contact (tests\codeception\unit\models\ContactFormTest::testContact) Ok
Test login no user (tests\codeception\unit\models\LoginFormTest::testLoginNoUser) Ok
Test login wrong password (tests\codeception\unit\models\LoginFormTest::testLoginWrongPassword) Ok
Test login correct (tests\codeception\unit\models\LoginFormTest::testLoginCorrect) Ok
-------------------------------------------------------------------------------------------------------------------------------------------------
Time: 47.82 seconds, Memory: 472.75Mb
OK (4 tests, 14 assertions)
similar symptom happens with yii2-advanced template.