Browse Source

And, add the other permutation too

This fails
AD7six 11 years ago
parent
commit
917c43ff04
1 changed files with 11 additions and 0 deletions
  1. 11 0
      tests/TestCase/ORM/TableTest.php

+ 11 - 0
tests/TestCase/ORM/TableTest.php

@@ -514,6 +514,17 @@ class TableTest extends TestCase
         $hasOneTable = $hasOne->target();
         $this->assertSame('Comments', $hasOne->alias());
         $this->assertSame('TestPlugin.Comments', $hasOne->registryAlias());
+
+        $options = ['className' => 'TestPlugin.Comments'];
+        $table = new Table(['table' => 'users']);
+
+        $hasOne = $table->hasOne('TestPlugin.Comments', $options);
+        $this->assertInstanceOf('Cake\ORM\Association\HasOne', $hasOne);
+        $this->assertSame('Comments', $hasOne->name());
+
+        $hasOneTable = $hasOne->target();
+        $this->assertSame('Comments', $hasOne->alias());
+        $this->assertSame('TestPlugin.Comments', $hasOne->registryAlias());
     }
 
     /**