ソースを参照

Remove use of TestCase::getMock() from "Validation" namepace tests.

ADmad 9 年 前
コミット
7fb1ea5a93

+ 3 - 1
tests/TestCase/Validation/RulesProviderTest.php

@@ -46,7 +46,9 @@ class RulesProviderTest extends TestCase
      */
     public function testCustomObject()
     {
-        $mock = $this->getMock('\Cake\Validation\Validator', ['field']);
+        $mock = $this->getMockBuilder('\Cake\Validation\Validator')
+            ->setMethods(['field'])
+            ->getMock();
         $mock->expects($this->once())
             ->method('field')
             ->with('first', null)

+ 6 - 2
tests/TestCase/Validation/ValidatorTest.php

@@ -758,7 +758,9 @@ class ValidatorTest extends TestCase
             ->add('email', 'alpha', ['rule' => 'alphanumeric'])
             ->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
 
-        $thing = $this->getMock('\stdClass', ['isCool']);
+        $thing = $this->getMockBuilder('\stdClass')
+            ->setMethods(['isCool'])
+            ->getMock();
         $thing->expects($this->once())->method('isCool')
             ->will($this->returnCallback(function ($data, $context) use ($thing) {
                 $this->assertEquals('bar', $data);
@@ -801,7 +803,9 @@ class ValidatorTest extends TestCase
             'rule' => ['isCool', 'and', 'awesome'],
             'provider' => 'thing'
         ]);
-        $thing = $this->getMock('\stdClass', ['isCool']);
+        $thing = $this->getMockBuilder('\stdClass')
+            ->setMethods(['isCool'])
+            ->getMock();
         $thing->expects($this->once())->method('isCool')
             ->will($this->returnCallback(function ($data, $a, $b, $context) use ($thing) {
                 $this->assertEquals('bar', $data);