Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a test for auto-tables with an alias
  • Loading branch information
AD7six committed Feb 16, 2015
1 parent 961d496 commit f6cc721
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/TestCase/ORM/TableRegistryTest.php
Expand Up @@ -170,6 +170,24 @@ public function testGet()
$this->assertEquals('my_articles', $result->table());
}

/**
* Are auto-models instanciated correctly? How about when they have an alias?
*
* @return void
*/
public function testGetFallbacks()
{
$result = TableRegistry::get('Droids');
$this->assertInstanceOf('Cake\ORM\Table', $result);
$this->assertEquals('droids', $result->table());
$this->assertEquals('Droids', $result->alias());

$result = TableRegistry::get('R2D2', ['className' => 'Droids']);
$this->assertInstanceOf('Cake\ORM\Table', $result);
$this->assertEquals('droids', $result->table());
$this->assertEquals('R2D2', $result->alias());
}

/**
* Test that get() uses config data set with config()
*
Expand Down

0 comments on commit f6cc721

Please sign in to comment.