Skip to content

Commit

Permalink
Make test more generalized.
Browse files Browse the repository at this point in the history
Don't use a hardcoded key to test deletes.
  • Loading branch information
markstory committed Oct 20, 2017
1 parent 1cb0a77 commit a9745f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/TestCase/ORM/TableUuidTest.php
Expand Up @@ -146,13 +146,12 @@ public function testSaveUpdate($tableName)
*/
public function testDelete($tableName)
{
$id = '481fc6d0-b920-43e0-a40d-6d1740cf8569';
$table = TableRegistry::get($tableName);
$entity = $table->find('all')->where(['id' => $id])->first();
$entity = $table->find('all')->firstOrFail();

$this->assertTrue($table->delete($entity));
$query = $table->find('all')->where(['id' => $id]);
$this->assertCount(0, $query->execute(), 'No rows left');
$query = $table->find('all')->where(['id' => $entity->id]);
$this->assertEmpty($query->first(), 'No row left');
}

/**
Expand Down

0 comments on commit a9745f1

Please sign in to comment.