diff --git a/tests/TestCase/ORM/TableRegistryTest.php b/tests/TestCase/ORM/TableRegistryTest.php index 017c98c840d..7579422b04d 100644 --- a/tests/TestCase/ORM/TableRegistryTest.php +++ b/tests/TestCase/ORM/TableRegistryTest.php @@ -345,4 +345,26 @@ public function testGenericInstances() { $this->assertEquals($expected, TableRegistry::genericInstances()); } +/** + * Tests deleting an instance + * + * @return void + */ + public function testDelete() { + Plugin::load('TestPlugin'); + + $pluginTable = TableRegistry::get('TestPlugin.Comments'); + $cachedTable = TableRegistry::get('Comments'); + + $this->assertTrue(TableRegistry::exists('Comments')); + $this->assertSame($pluginTable, $cachedTable); + + TableRegistry::delete('Comments'); + $this->assertFalse(TableRegistry::exists('Comments')); + + $appTable = TableRegistry::get('Comments'); + $this->assertTrue(TableRegistry::exists('Comments')); + $this->assertNotSame($pluginTable, $appTable); + } + }