当我运行测试夹具数据时,未在db中填充数据。另外,我将cleanup
设置为false
以确保。这些测试似乎令人困惑。我将代码接收的整个文档以及Yii2
部分都加了红色,但是仍然很不清楚。我究竟做错了什么 ?
suite_namespace: frontend\tests\unit
actor: UnitTester
modules:
enabled:
- Yii2:
part: [orm, email, fixtures]
cleanup: false
- Asserts
和班级
class ClientTest extends \Codeception\Test\Unit
{
/**
* @var \frontend\tests\UnitTester
*/
protected $tester;
public function _before()
{
return [
'client' => [
'class' => CrmClient::class,
'dataFile' => codecept_data_dir() . 'client.php'
]
];
}
public function testClientFields()
{
$this->tester->seeRecord(CrmClient::class, ['company' => 111]);
}
}
编辑:
client.php
文件:
<?php
return [
[
'company' => '111',
'company_name' => 'company_name',
'company_description' => 'company_description',
'company_email' => 'company_email@abv.bg',
'company_phone' => '0888888888',
'uic' => '4444213',
'person_in_charge' => 'test',
'vat' => '1',
'vat_number' => '12312321',
'egn' => '12312321',
'email' => 'az@abv.bg',
'phone' => '1231231',
'country_id' => '33',
'region_id' => '558',
'city_id' => '9853',
'group_id' => '2',
'active' => '1',
'archive' => '0',
'default_client' => '0',
'company_address' => 'comapny address',
'address' => 'address',
],
];