Browse Source

Test TableRegistry seperately.

Robert Pustułka 9 years ago
parent
commit
2e9e77bc6d
1 changed files with 24 additions and 1 deletions
  1. 24 1
      tests/TestCase/ORM/TableRegistryTest.php

+ 24 - 1
tests/TestCase/ORM/TableRegistryTest.php

@@ -73,14 +73,37 @@ class TableRegistryTest extends TestCase
      */
     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.
      *
      * @return void