Skip to content

Commit

Permalink
Add stub test case methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 26, 2013
1 parent 54efd12 commit 5e5af94
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Cake/ORM/Entity.php
Expand Up @@ -318,6 +318,21 @@ public function hiddenProperties() {
return $this->_hidden;
}

/**
* Get the list of visible properties.
*
* The list of visible properties is all standard properties
* plus virtual properties minus hidden properties.
*
* @return array A list of properties that are 'visible' in all
* representations.
*/
public function visibleProperties() {
$properties = array_keys($this->_properties);
$properties = array_merge($properties, $this->_virtual);
return array_diff($properties, $this->_hidden);
}

/**
* Returns an array with all the properties that have been set
* to this entity
Expand All @@ -329,7 +344,7 @@ public function hiddenProperties() {
*/
public function toArray() {
$result = [];
foreach ($this->_properties as $property => $value) {
foreach ($this->visibleProperties() as $property) {
$value = $this->get($property);
if (is_array($value) && isset($value[0]) && $value[0] instanceof self) {
$result[$property] = [];
Expand Down
17 changes: 17 additions & 0 deletions Cake/Test/TestCase/ORM/EntityTest.php
Expand Up @@ -649,6 +649,14 @@ public function testToArrayWithAccessor() {
$this->assertEquals($expected, $entity->toArray());
}

public function testToArrayHiddenProperties() {
$this->markTestIncomplete("not done");
}

public function testToArrayVirtualProperties() {
$this->markTestIncomplete("not done");
}

/**
* Tests that missing fields will not be passed as null to the validator
*
Expand Down Expand Up @@ -745,4 +753,13 @@ public function testCleanRemovesErrors() {
$entity->clean();
$this->assertEmpty($entity->errors());
}

public function testHideProperties() {
$this->markTestIncomplete("not done");
}

public function testVisibleProperties() {
$this->markTestIncomplete("not done");
}

}

0 comments on commit 5e5af94

Please sign in to comment.