I am trying to write testing for a behavior written with yii3 (multilingual behavior).
I am not that experienced with PHPUnit so I am reading the documentation and the tests in yii repos.
I was not able to mock the application. I am always getting the following exception
yii\di\exceptions\InvalidConfigException: Failed to instantiate "app".
/app/vendor/yiisoft/di/src/AbstractContainer.php:417
/app/vendor/yiisoft/di/src/AbstractContainer.php:340
/app/vendor/yiisoft/di/src/AbstractContainer.php:186
/app/vendor/yiisoft/di/src/AbstractContainer.php:131
/app/vendor/yiisoft/di/src/Container.php:55
/app/vendor/yiisoft/yii-core/tests/TestCase.php:90
/app/tests/PolyglotBehaviorTest.php:19
/app/vendor/phpunit/phpunit/phpunit:53
Caused by
ReflectionException: Class app does not exist
/app/vendor/yiisoft/di/src/AbstractContainer.php:415
/app/vendor/yiisoft/di/src/AbstractContainer.php:340
/app/vendor/yiisoft/di/src/AbstractContainer.php:186
/app/vendor/yiisoft/di/src/AbstractContainer.php:131
/app/vendor/yiisoft/di/src/Container.php:55
/app/vendor/yiisoft/yii-core/tests/TestCase.php:90
/app/tests/PolyglotBehaviorTest.php:19
/app/vendor/phpunit/phpunit/phpunit:53
my test class is
class PolyglotBehaviorTest extends \yii\tests\TestCase
{
protected function setUp()
{
parent::setUp(); // TODO: Change the autogenerated stub
$this->mockApplication();
}
public function testSql()
{
$this->assertEquals(2, 01+1);
}
}
What am I doing wrong? Anybody have an advice where to start with this topic?