我正在尝试运行简单的测试,并通过fixture dataFile在数据库中插入两条记录。我得到的是:
[ReflectionException] Class C:\xampp\htdocs\codeception\frontend\tests/_data\user.php does not exist文件显然就在那里。我的UserTest.php看起来像这样:
<?php
class UserTest extends \Codeception\Test\Unit
{
public function _fixtures()
{
return [
'class' => \frontend\tests\fixtures\UserFixture::className(),
'dataFile' => codecept_data_dir() . 'user.php'
];
}
public function testValidation()
{
$user = new \common\models\User();
$user->setUsername(null);
$this->assertFalse($user->validate(['username']));
$user->setUsername('aaaaaaaaaaaaaaaaaaaaaaaaaa');
$this->assertFalse($user->validate(['username']));
$user->setUsername('toma');
$this->assertTrue($user->validate(['username']));
}
public function testIfUserExist()
{
$this->tester->seeRecord('user', ['name' => 'Toma']);
}
}我在错误中看到linux喜欢正斜杠,但不知道如何更改它。我不确定这是否是问题所在,因为我对一些图像有相同的路径,当时它是好的。是什么导致了这种情况?谢谢!
https://stackoverflow.com/questions/51313356
复制相似问题