From a9745f138549dfbaae3de94e92212777b64c143a Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 19 Oct 2017 21:00:21 -0400 Subject: [PATCH] Make test more generalized. Don't use a hardcoded key to test deletes. --- tests/TestCase/ORM/TableUuidTest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/TestCase/ORM/TableUuidTest.php b/tests/TestCase/ORM/TableUuidTest.php index 1d97324cf41..53731317eac 100644 --- a/tests/TestCase/ORM/TableUuidTest.php +++ b/tests/TestCase/ORM/TableUuidTest.php @@ -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'); } /**