Acceptance test does not like constants in index-test.php?


(Blaces) #1

Hi all

I run the codeception run command and the acceptance tests are failed (The functional tests are not).

In the index.php file I defined a START_TIME constant, so I added it to the




defined('START_TIME') or define('START_TIME', microtime(true));



If I open the example.dev/index-test.php it is fine, everything ok. But when I run codeception test:




1) Failed to ensure that about works in AboutCept (/home/user/Projects/yii-basic/tests/codeception/functional//AboutCept.php)

Can't be on page "/index-test.php/site/about":

yii\base\ErrorException: Use of undefined constant START_TIME - assumed 'START_TIME'


Scenario Steps:

1. I am on page "/index-test.php/site/about"


#1  /home/user/Projects/yii-basic/views/layouts/main.php:81

#2  /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/View.php:325

#3  /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/View.php:247

#4  /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/Controller.php:392

#5  /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/Controller.php:378

#6  /home/user/Projects/yii-basic/controllers/SiteController.php:104

#7  app\controllers\SiteController->actionAbout

#8  /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/InlineAction.php:55

#9  /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/Controller.php:154

#10 /home/user/Projects/yii-basic/vendor/yiisoft/yii2/base/Module.php:454



Does somebody know how can I solve this error?