Answer the question
In order to leave comments, you need to log in
Why doesn't the delete test pass?
unit test. Trying to start testing (Yii2)
Made fixtures
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.
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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question