Skip to content

Commit

Permalink
Test TableRegistry seperately.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pustułka committed Apr 21, 2017
1 parent d58c185 commit 2e9e77b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/TestCase/ORM/TableRegistryTest.php
Expand Up @@ -73,13 +73,36 @@ protected function _setMockLocator()
*/
public function testLocator()
{
$this->assertInstanceOf('Cake\ORM\Locator\LocatorInterface', TableRegistry::getTableLocator());
$this->assertInstanceOf('Cake\ORM\Locator\LocatorInterface', TableRegistry::locator());

$locator = $this->getMockBuilder('Cake\ORM\Locator\LocatorInterface')->getMock();
TableRegistry::locator($locator);

$this->assertSame($locator, TableRegistry::locator());
}

/**
* Test testSetLocator() method.
*
* @return void
*/
public function testSetLocator()
{
$locator = $this->_setMockLocator();

$this->assertSame($locator, TableRegistry::getTableLocator());
}

/**
* Test testSetLocator() method.
*
* @return void
*/
public function testGetLocator()
{
$this->assertInstanceOf('Cake\ORM\Locator\LocatorInterface', TableRegistry::getTableLocator());
}

/**
* Test that locator() method is returning TableLocator by default.
*
Expand Down

0 comments on commit 2e9e77b

Please sign in to comment.