Skip to content
Permalink
Browse files

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

  • Loading branch information...
ADmad committed Jun 5, 2016
1 parent b4b4d3d commit 7fb1ea5a9321d192db652868cc6b5842d410f1fe
Showing with 9 additions and 3 deletions.
  1. +3 −1 tests/TestCase/Validation/RulesProviderTest.php
  2. +6 −2 tests/TestCase/Validation/ValidatorTest.php
@@ -46,7 +46,9 @@ public function testProxyToValidation()
*/
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)
@@ -758,7 +758,9 @@ public function testErrorsFromCustomProvider()
->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 @@ public function testMethodsWithExtraArguments()
'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);

0 comments on commit 7fb1ea5

Please sign in to comment.
You can’t perform that action at this time.