Skip to content

Commit

Permalink
Insert and Update no data exception test case
Browse files Browse the repository at this point in the history
  • Loading branch information
atishhamte committed Apr 13, 2019
1 parent 515b55d commit 43451aa
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/system/Database/Live/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1551,4 +1551,39 @@ public function testUndefinedEntityPropertyException()
}

//--------------------------------------------------------------------

public function testInsertWithNoDataException()
{
$model = new UserModel();
$data = [];
$this->expectException(DataException::class);
$this->expectExceptionMessage('There is no data to insert.');
$model->insert($data);
}

//--------------------------------------------------------------------

public function testUpdateWithNoDataException()
{
$model = new EventModel();

$data = [
'name' => 'Foo',
'email' => 'foo@example.com',
'country' => 'US',
'deleted' => 0,
];

$id = $model->insert($data);

$data = [];

$this->expectException(DataException::class);
$this->expectExceptionMessage('There is no data to update.');

$model->update($id, $data);
}

//--------------------------------------------------------------------

}

0 comments on commit 43451aa

Please sign in to comment.