Browse Source

Add test to increase coverage.

Mark Story 8 years ago
parent
commit
5428f608b1
1 changed files with 14 additions and 0 deletions
  1. 14 0
      tests/TestCase/ORM/Association/HasManyTest.php

+ 14 - 0
tests/TestCase/ORM/Association/HasManyTest.php

@@ -923,4 +923,18 @@ class HasManyTest extends TestCase
         ]);
         $this->assertEmpty($entity->get('comments'));
     }
+
+    /**
+     * Tests that providing an invalid strategy throws an exception
+     *
+     * @return void
+     */
+    public function testInvalidStrategy()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $articles = TableRegistry::get('Articles');
+
+        $association = $articles->hasMany('Comments');
+        $association->setStrategy('anotherThing');
+    }
 }