0

i've been wondering if there is a way to use constants/variables from Yii in codeception tests (cests and/or cepts).

Im talking about Yii::app()->... or some properties from the Yii models.

Im using yii 1.14 and codeception 1.8

6
  • Maybe this help you: example Commented Aug 12, 2015 at 10:33
  • @DanilaGanchar That won't work as i need to call Yii from inside the codeception tests, not the other way around. Commented Aug 12, 2015 at 10:48
  • as I understand, you want in codeception tests use Yii components? Is it right? Commented Aug 12, 2015 at 10:51
  • I have not worked with codeception. How you start tests? From console? Commented Aug 12, 2015 at 10:59
  • Yes, tests are started from the console. Here is an example: ProjectRoot > php common\vendors\codeception\codecept.phar run api -c api/protected/codeception.yml Commented Aug 12, 2015 at 11:03

1 Answer 1

1

Turned out you can load yii (the same way its loaded in your index file) in _bootstrap.php, you just don't need to call Yii::app()->run(); at the end of it.

Not sure if its the correct way, but so far thats the only working way i know of.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.