Skip to content

Commit

Permalink
Fix validator call
Browse files Browse the repository at this point in the history
  • Loading branch information
raul338 committed Apr 22, 2018
1 parent 6251162 commit ff684ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Model/Behavior/UploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function initialize(array $config)
*/
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
{
$validator = $this->_table->validator();
$validator = $this->_table->getValidator();
$dataArray = $data->getArrayCopy();
foreach (array_keys($this->getConfig(null, [])) as $field) {
if (!$validator->isEmptyAllowed($field, false)) {
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Model/Behavior/UploadBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function testBeforeMarshalOk()

$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$table->expects($this->once())
->method('validator')
->method('getValidator')
->will($this->returnValue($validator));

$methods = array_diff($this->behaviorMethods, ['beforeMarshal']);
Expand All @@ -204,7 +204,7 @@ public function testBeforeMarshalError()

$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$table->expects($this->once())
->method('validator')
->method('getValidator')
->will($this->returnValue($validator));

$methods = array_diff($this->behaviorMethods, ['beforeMarshal']);
Expand All @@ -230,7 +230,7 @@ public function testBeforeMarshalEmptyAllowed()

$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$table->expects($this->once())
->method('validator')
->method('getValidator')
->will($this->returnValue($validator));

$methods = array_diff($this->behaviorMethods, ['beforeMarshal']);
Expand Down

0 comments on commit ff684ab

Please sign in to comment.