Unit тест. Пытаюсь начать тестировать (Yii2)
Сделал фикстуры
public function _fixtures() {
return [
'menu' => [
'class' => \common\fixtures\MenuFixture::className(),
'dataFile' => codecept_data_dir() . 'menu.php'
]
];
}
Заполнил файл
menu.php
Сделал тест на создание
public function testCreateMenuItem() {
$model = new Menu([
'label' => 'Контакты',
'url' => 'contacts',
'order' => '8',
'created_at' => '1402312317',
'updated_at' => '1402312317',
'delete_at' => '0',
]);
$this->assertTrue($model->validate());
$this->assertTrue($model->save());
}
Вроде всё ок (но как понимаю, фикстуры тут не задействованы)
Делаю тест на удаление
public function testDeleteMenuItem() {
$model = Menu::findOne(1);
$this->assertTrue($model->delete());
}
Но он не проходит
Failed asserting that 1 is true.
При запуске codecept --debug
MenuTest: Delete menu item Destroying application
Starting application
[ConnectionWatcher] watching new connections
[Fixtures] Loading fixtures
[ConnectionWatcher] watching new connections
[yii\db\Connection::open] 'Opening DB connection: mysql:host=localhost;dbname=may_test'
[ConnectionWatcher] Connection opened!
[ConnectionWatcher] Connection opened!
[ConnectionWatcher] no longer watching new connections
[ConnectionWatcher] closing all (1) connections
[Fixtures] Done
[TransactionForcer] watching new connections
[yii\db\Connection::open] 'Opening DB connection: mysql:host=localhost;dbname=may_test'
[ConnectionWatcher] Connection opened!
[TransactionForcer] Connection opened!
[TransactionForcer] Transaction started for: mysql:host=localhost;dbname=may_test
x MenuTest: Delete menu item (0.03s)
[TransactionForcer] Transaction cancelled; all changes reverted.
[TransactionForcer] no longer watching new connections
Destroying application
[ConnectionWatcher] no longer watching new connections
[ConnectionWatcher] closing all (2) connections
Suite done, restoring $_SERVER to original
Почему не проходит??