Skip to content

Commit

Permalink
Add test for TableRegistry::delete()
Browse files Browse the repository at this point in the history
  • Loading branch information
Berry Goudswaard committed Dec 22, 2014
1 parent 16c36b1 commit f16c471
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/TestCase/ORM/TableRegistryTest.php
Expand Up @@ -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);
}

}

0 comments on commit f16c471

Please sign in to comment.