I am trying to import fixtures in my CakePHP 3.x plugin. When I launch the tests, I always get the error :
UserManager\Test\TestCase\Controller\UsersControllerTest::testProfile exception 'Cake\Datasource\Exception\RecordNotFoundException' with message 'Record not found in table "users"
Here is UsersFixture.php :
namespace UserManager\Test\Fixture;
use Cake\TestSuite\Fixture\TestFixture;
class UsersFixture extends TestFixture {
public $import = ['table' => 'users'];
}
My test fails because it can not find the current user in test database.
I supposed that users table is created successfully, but no data are imported.
Of course, many users are recorded in my existing users table, and the tested user id is one of these records.
My testIndex() method fails too, because number of records is always equal to 0.
Why does the fixtures table not contain my records ?