Skip to content

Commit

Permalink
Add convirmatory exists test
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Feb 10, 2015
1 parent fd701cc commit 18907a4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/TestCase/ORM/TableRegistryTest.php
Expand Up @@ -133,6 +133,25 @@ public function testExists()
$this->assertTrue(TableRegistry::exists('Articles'));
}

/**
* Test the exists() method with plugin-prefixed models.
*
* @return void
*/
public function testExistsPlugin()
{
$this->assertFalse(TableRegistry::exists('Comments'));
$this->assertFalse(TableRegistry::exists('TestPlugin.Comments'));

TableRegistry::config('TestPlugin.Comments', ['table' => 'comments']);
$this->assertFalse(TableRegistry::exists('Comments'), 'The Comments key should not be populated');
$this->assertFalse(TableRegistry::exists('TestPlugin.Comments'), 'The plugin.alias key should not be populated');

TableRegistry::get('TestPlugin.Comments', ['table' => 'comments']);
$this->assertFalse(TableRegistry::exists('Comments'), 'The Comments key should not be populated');
$this->assertTrue(TableRegistry::exists('TestPlugin.Comments'), 'The plugin.alias key should now be populated');
}

/**
* Test getting instances from the registry.
*
Expand Down

0 comments on commit 18907a4

Please sign in to comment.