Browse Source

Add tests for deprecated method to not drop coverage.

Mark Story 8 years ago
parent
commit
90f00d7800
1 changed files with 35 additions and 0 deletions
  1. 35 0
      tests/TestCase/ORM/AssociationTest.php

+ 35 - 0
tests/TestCase/ORM/AssociationTest.php

@@ -534,6 +534,22 @@ class AssociationTest extends TestCase
     }
 
     /**
+     * Tests dependent method
+     *
+     * @group deprecated
+     * @return void
+     */
+    public function testDependent()
+    {
+        $this->deprecated(function () {
+            $this->assertTrue($this->association->dependent());
+            $this->association->dependent(false);
+            $this->assertFalse($this->association->dependent());
+        });
+    }
+
+
+    /**
      * Tests property method
      *
      * @group deprecated
@@ -605,10 +621,29 @@ class AssociationTest extends TestCase
     /**
      * Tests strategy method
      *
+     * @group deprecated
      * @return void
      */
     public function testStrategy()
     {
+        $this->deprecated(function () {
+            $this->assertEquals('join', $this->association->strategy());
+
+            $this->association->strategy('select');
+            $this->assertEquals('select', $this->association->strategy());
+
+            $this->association->strategy('subquery');
+            $this->assertEquals('subquery', $this->association->strategy());
+        });
+    }
+
+    /**
+     * Tests strategy method
+     *
+     * @return void
+     */
+    public function testSetStrategy()
+    {
         $this->assertEquals('join', $this->association->getStrategy());
 
         $this->association->setStrategy('select');