From ae59d5c4a1d2d04a3db1453e2beb5b7ce815acf6 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 21 Dec 2013 22:44:17 -0500 Subject: [PATCH] Fix failing tests in Entity test. --- Cake/Test/TestCase/ORM/EntityTest.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Cake/Test/TestCase/ORM/EntityTest.php b/Cake/Test/TestCase/ORM/EntityTest.php index 73a6a5574ce..91f498f2dbb 100644 --- a/Cake/Test/TestCase/ORM/EntityTest.php +++ b/Cake/Test/TestCase/ORM/EntityTest.php @@ -1,7 +1,5 @@ accessible('*', true); + $entity->set(['foo' => 'bar', 'id' => 1]); $this->assertEquals('bar', $entity->foo); $this->assertSame(1, $entity->id); @@ -83,6 +83,7 @@ public function testSetOneParamWithSetter() { */ public function testMultipleWithSetter() { $entity = $this->getMock('\Cake\ORM\Entity', ['setName', 'setStuff']); + $entity->accessible('*', true); $entity->expects($this->once())->method('setName') ->with('Jones') ->will($this->returnCallback(function($name) { @@ -107,6 +108,8 @@ public function testMultipleWithSetter() { */ public function testBypassSetters() { $entity = $this->getMock('\Cake\ORM\Entity', ['setName', 'setStuff']); + $entity->accessible('*', true); + $entity->expects($this->never())->method('setName'); $entity->expects($this->never())->method('setStuff'); @@ -372,14 +375,16 @@ public function testGetArrayAccess() { */ public function testSetArrayAccess() { $entity = $this->getMock('\Cake\ORM\Entity', ['set']); + $entity->accessible('*', true); + $entity->expects($this->at(0)) ->method('set') - ->with(['foo' => 1]) + ->with('foo', 1) ->will($this->returnSelf()); $entity->expects($this->at(1)) ->method('set') - ->with(['bar' => 2]) + ->with('bar', 2) ->will($this->returnSelf()); $entity['foo'] = 1; @@ -662,6 +667,7 @@ public function testToArrayRecursive() { */ public function testToArrayWithAccessor() { $entity = $this->getMock('\Cake\ORM\Entity', ['getName']); + $entity->accessible('*', true); $entity->set(['name' => 'Mark', 'email' => 'mark@example.com']); $entity->expects($this->any()) ->method('getName') @@ -690,6 +696,8 @@ public function testToArrayHiddenProperties() { */ public function testToArrayVirtualProperties() { $entity = $this->getMock('\Cake\ORM\Entity', ['getName']); + $entity->accessible('*', true); + $entity->expects($this->any()) ->method('getName') ->will($this->returnValue('Jose')); @@ -717,6 +725,8 @@ public function testValidateMissingFields() { ->setMethods(['getSomething']) ->disableOriginalConstructor() ->getMock(); + $entity->accessible('*', true); + $validator = $this->getMock('\Cake\Validation\Validator'); $entity->set('a', 'b');