How to load fixture?


(Aleksey Bykov) #1

I use a simple fixture to populate the table in the test database. But when I try to load it, check integrity code throws exception ‘Table not found: []’.


<?php


namespace tests\unit\fixtures;


use yii\test\ActiveFixture;


class IdentityDocumentFixture extends ActiveFixture

{

    public $modelClass = 'backend\modules\persons\models\IdentityDocument';

}

To load fixture, I use this command from @app/tests:


C:\php-projects\ais\tests\codeception\bin>yii fixture/load IdentityDocument

Fixtures namespace is:

        tests\unit\fixtures


Global fixtures will be used:


        1. yii\test\InitDb


Fixtures below will be loaded:


        1. IdentityDocument


Load above fixtures? (yes|no) [no]:yes

As a result, I get this error message:

Stack trace:

How to load fixture? A test database exists, the data sources are configured correctly.


(Koji6ac9h) #2

Check: IdentiyDocument::tableName