Browse Source

Add test for TableRegistry::set with plugin syntax aliases

Berry Goudswaard 11 years ago
parent
commit
fc84ac1be0
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/TestCase/ORM/TableRegistryTest.php

+ 15 - 0
tests/TestCase/ORM/TableRegistryTest.php

@@ -319,6 +319,21 @@ class TableRegistryTest extends TestCase {
 	}
 
 /**
+ * Test setting an instance with plugin syntax aliases
+ *
+ * @return void
+ */
+	public function testSetPlugin() {
+		Plugin::load('TestPlugin');
+
+		$mock = $this->getMock('TestPlugin\Model\Table\CommentsTable');
+
+		$this->assertSame($mock, TableRegistry::set('TestPlugin.Comments', $mock));
+		$this->assertSame($mock, TableRegistry::get('TestPlugin.Comments'));
+		$this->assertSame($mock, TableRegistry::get('Comments'));
+	}
+
+/**
  * Tests genericInstances
  *
  * @return void