Skip to content

Commit 472ce24

Browse files
committed
Update MY_Model::delete tests for 6682478
Changes to the delete methods in 6682478 resulted in failures in the tests. Since the tests did not break based on the function results, I've updated the tests to reflect the changes in the model. One item I did not fix is that the tests don't handle method chaining on $this->db properly, so the tests error out when they encounter any use of this feature.
1 parent c9dde58 commit 472ce24

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/bonfire/core/MY_Model_test.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require_once (TESTS_DIR .'_support/database.php');
3+
require_once(TESTS_DIR . '_support/database.php');
44
//require (APPPATH .'core/MY_Model.php');
55

66
class MY_Model_test extends CI_UnitTestCase {
@@ -184,7 +184,8 @@ public function test_update_where()
184184

185185
public function test_delete_without_soft_deletes()
186186
{
187-
$this->model->db->expectOnce('delete', array('records_table', array('id' => 1)));
187+
$this->model->db->expectOnce('where', array('id', 1));
188+
$this->model->db->expectOnce('delete', array('records_table'));
188189
$this->model->db->returns('delete', TRUE);
189190

190191
$this->assertTrue( $this->model->soft_delete(false)->delete(1) );
@@ -205,7 +206,7 @@ public function test_delete_with_soft_deletes()
205206

206207
public function test_delete_where_without_soft_deletes()
207208
{
208-
$this->model->db->expectOnce('where', array('userid', 5));
209+
$this->model->db->expectOnce('where', array(array('userid' => 5)));
209210
$this->model->db->expectOnce('delete', array('records_table'));
210211
$this->model->db->returns('affected_rows', 1);
211212
$this->model->db->returns('delete', TRUE);
@@ -217,7 +218,7 @@ public function test_delete_where_without_soft_deletes()
217218

218219
public function test_delete_where_with_soft_deletes()
219220
{
220-
$this->model->db->expectOnce('where', array('userid', 5));
221+
$this->model->db->expectOnce('where', array(array('userid' => 5)));
221222
$this->model->db->expectOnce('update', array('records_table', array('deleted' => 1)));
222223
$this->model->db->returns('affected_rows', 1);
223224
$this->model->db->returns('update', TRUE);

0 commit comments

Comments
 (0)