Hi,
I am having problem with testing backend tests.
When I run test on the backend I have the following error:
Test tests/unit/models/TestNameTest.php:testFeature
[RuntimeException] Call to undefined method backend\tests\UnitTester::haveFixtures
TestNameTest class:
<?php
namespace backend\tests\models;
use Codeception\Util\Debug;
use common\fixtures\SomeModel as SomeModelFixture;
class TestNameTest extends \Codeception\Test\Unit
{
/**
* @var \backend\tests\UnitTester
*/
protected $tester;
public function _before()
{
$this->tester->haveFixtures([
'data' => [
'class' => SomeModelFixture::className(),
'dataFile' => codecept_data_dir() . 'some_modal_data.php'
],
]);
}
public function testFeature() {
$data = $this->tester->grabFixture('data', 0);
$model = new SomeModel(['scenario' => SomeModel::SCENARIO_ADMIN]);
expect_not($model->save());
}
}
Could anybody tell what is wrong with the test above?
\backend\tests\UnitTester (code below) exists in _support folder and it has correct namespacing as well.
<?php
namespace backend\tests;
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;
/**
* Define custom actions here
*/
}
Gues, any ideas? Maybe somebody already crossed this issue?