Skip to content

Commit

Permalink
Add tests for single set + accessible properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 22, 2013
1 parent ae59d5c commit bc8f1ce
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Cake/Test/TestCase/ORM/EntityTest.php
Expand Up @@ -927,4 +927,24 @@ public function testSetWithAccessibleWithArray() {
$this->assertEquals(5, $entity->get('foo'));
}

/**
* Test that accessible() and single property setting works.
*
* @return
*/
public function testSetWithAccessibleSingleProperty() {
$entity = new Entity(['foo' => 1, 'bar' => 2]);
$entity->accessible('title', true);

$entity->set(['title' => 'test', 'body' => 'Nope']);
$this->assertEquals('test', $entity->title);
$this->assertNull($entity->body);

$entity->body = 'Yep';
$this->assertEquals('Yep', $entity->body, 'Single set should bypass guards.');

$entity->set('body', 'Yes');
$this->assertEquals('Yes', $entity->body, 'Single set should bypass guards.');
}

}

0 comments on commit bc8f1ce

Please sign in to comment.