Skip to content

Commit

Permalink
Fix up tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Jan 3, 2016
1 parent 5426aeb commit 9415d44
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Datasource/EntityTrait.php
Expand Up @@ -794,9 +794,9 @@ protected function _readError($object, $path = null)
* This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes
* or to be able to log it away.
*
* @param string|array|null $field
* @param string|null $value
* @param bool $overwrite
* @param string|array|null $field The field to get invalid value for, or the value to set.
* @param mixed|null $value The invalid value to be set for $field.
* @param bool $overwrite Whether or not to overwrite pre-existing values for $field.
* @return $this|mixed
*/
public function invalid($field = null, $value = null, $overwrite = false)
Expand Down
6 changes: 3 additions & 3 deletions src/Datasource/InvalidPropertyInterface.php
Expand Up @@ -27,9 +27,9 @@ interface InvalidPropertyInterface
* This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes
* or to be able to log it away.
*
* @param string|array|null $field
* @param string|null $value
* @param bool $overwrite
* @param string|array|null $field The field to get invalid value for, or the value to set.
* @param mixed|null $value The invalid value to be set for $field.
* @param bool $overwrite Whether or not to overwrite pre-existing values for $field.
* @return $this|mixed
*/
public function invalid($field = null, $value = null, $overwrite = false);
Expand Down
3 changes: 1 addition & 2 deletions src/ORM/Entity.php
Expand Up @@ -15,16 +15,15 @@
namespace Cake\ORM;

use Cake\Datasource\EntityInterface;
use Cake\Datasource\InvalidPropertyInterface;
use Cake\Datasource\EntityTrait;
use Cake\Datasource\InvalidPropertyInterface;

/**
* An entity represents a single result row from a repository. It exposes the
* methods for retrieving and storing properties associated in this row.
*/
class Entity implements EntityInterface, InvalidPropertyInterface
{

use EntityTrait;

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase/ORM/EntityTest.php
Expand Up @@ -1205,6 +1205,7 @@ public function testDebugInfo()
$entity->virtualProperties(['baz']);
$entity->dirty('foo', true);
$entity->errors('foo', ['An error']);
$entity->invalid('foo', 'a value');
$entity->source('foos');
$result = $entity->__debugInfo();
$expected = [
Expand All @@ -1216,6 +1217,7 @@ public function testDebugInfo()
'[original]' => [],
'[virtual]' => ['baz'],
'[errors]' => ['foo' => ['An error']],
'[invalid]' => ['foo' => 'a value'],
'[repository]' => 'foos'
];
$this->assertSame($expected, $result);
Expand Down
5 changes: 3 additions & 2 deletions tests/TestCase/ORM/MarshallerTest.php
Expand Up @@ -2524,11 +2524,12 @@ public function testPassingCustomValidator()
}

/**
* Tests that invalid propery is being filled when data cannot be patched into an entity
* Tests that invalid property is being filled when data cannot be patched into an entity.
*
* @return void
*/
public function testValidationWithInvalidFilled() {
public function testValidationWithInvalidFilled()
{
$data = [
'title' => 'foo',
'number' => 'bar',
Expand Down

0 comments on commit 9415d44

Please sign in to comment.