From ae5e7508dfdad0451fe3e98efd19ffe601a960fe Mon Sep 17 00:00:00 2001 From: AD7six Date: Mon, 16 Feb 2015 11:44:15 +0000 Subject: [PATCH] Add plugin examples And correct typo --- tests/TestCase/ORM/TableRegistryTest.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/TestCase/ORM/TableRegistryTest.php b/tests/TestCase/ORM/TableRegistryTest.php index 2d9b856d68b..7bfea83a453 100644 --- a/tests/TestCase/ORM/TableRegistryTest.php +++ b/tests/TestCase/ORM/TableRegistryTest.php @@ -192,9 +192,19 @@ public function testGetFallbacks() $this->assertEquals('rebels', $result->table(), 'The table should be taken from options'); $this->assertEquals('C3P0', $result->alias()); + $result = TableRegistry::get('Funky.Chipmunks'); + $this->assertInstanceOf('Cake\ORM\Table', $result); + $this->assertEquals('chipmunks', $result->table(), 'The table should be derived from the alias'); + $this->assertEquals('Chipmunks', $result->alias()); + + $result = TableRegistry::get('Awesome', ['className' => 'Funky.Monkies']); + $this->assertInstanceOf('Cake\ORM\Table', $result); + $this->assertEquals('monkies', $result->table(), 'The table should be derived from the classname'); + $this->assertEquals('Awesome', $result->alias()); + $result = TableRegistry::get('Stuff', ['className' => 'Cake\ORM\Table']); $this->assertInstanceOf('Cake\ORM\Table', $result); - $this->assertEquals('stuff', $result->table(), 'The table should be drived from the alias'); + $this->assertEquals('stuff', $result->table(), 'The table should be derived from the alias'); $this->assertEquals('Stuff', $result->alias()); }