Skip to content

Commit a9745f1

Browse files
committed
Make test more generalized.
Don't use a hardcoded key to test deletes.
1 parent 1cb0a77 commit a9745f1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/TestCase/ORM/TableUuidTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,12 @@ public function testSaveUpdate($tableName)
146146
*/
147147
public function testDelete($tableName)
148148
{
149-
$id = '481fc6d0-b920-43e0-a40d-6d1740cf8569';
150149
$table = TableRegistry::get($tableName);
151-
$entity = $table->find('all')->where(['id' => $id])->first();
150+
$entity = $table->find('all')->firstOrFail();
152151

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

158157
/**

0 commit comments

Comments
 (0)