Skip to content
Permalink
Browse files

Add tests for single set + accessible properties.

  • Loading branch information...
markstory committed Dec 22, 2013
1 parent ae59d5c commit bc8f1ced98859f22a957ce85c0f18a94805bd5e7
Showing with 20 additions and 0 deletions.
  1. +20 −0 Cake/Test/TestCase/ORM/EntityTest.php
@@ -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.
You can’t perform that action at this time.