Browse Source

Add plugin examples

And correct typo
AD7six 11 years ago
parent
commit
ae5e7508df
1 changed files with 11 additions and 1 deletions
  1. 11 1
      tests/TestCase/ORM/TableRegistryTest.php

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

@@ -192,9 +192,19 @@ class TableRegistryTest extends TestCase
         $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());
     }