Browse Source

Add assertion on setMatching return type

antograssiot 9 years ago
parent
commit
d06e4d9a45
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/TestCase/ORM/EagerLoaderTest.php

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

@@ -530,4 +530,19 @@ class EagerLoaderTest extends TestCase
 
         return $elements;
     }
+
+    /**
+     * Assert that matching('something') and SetMatching('something') return consistent type
+     */
+    public function testSetMatchingReturnType()
+    {
+        $loader = new EagerLoader();
+        $result = $loader->setMatching('clients');
+        $this->assertArrayHasKey('clients', $result);
+        $this->assertArrayHasKey('clients', $loader->getMatching());
+
+        $result = $loader->matching('customers');
+        $this->assertArrayHasKey('customers', $result);
+        $this->assertArrayHasKey('customers', $loader->getMatching());
+    }
 }