Browse Source

Add test for TableRegistry::config with plugin syntax aliases

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

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

@@ -82,6 +82,28 @@ class TableRegistryTest extends TestCase {
 	}
 
 /**
+ * Test config() method with plugin syntax aliases
+ *
+ * @return void
+ */
+	public function testConfigPlugin() {
+		Plugin::load('TestPlugin');
+
+		$data = [
+			'connection' => 'testing',
+			'entityClass' => 'TestPlugin\Model\Entity\Comment',
+		];
+
+
+		$result = TableRegistry::config('TestPlugin.TestPluginComments', $data);
+		$this->assertEquals($data, $result, 'Returns config data.');
+
+		$result = TableRegistry::config();
+		$expected = ['TestPluginComments' => $data];
+		$this->assertEquals($expected, $result);
+	}
+
+/**
  * Test calling config() on existing instances throws an error.
  *
  * @expectedException \RuntimeException