Skip to content

Commit

Permalink
Updated test related to displaying errors in nested properties
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Feb 27, 2014
1 parent 2f5499d commit cd9e2ca
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -2024,6 +2024,24 @@ public function testEmptyInputErrorValidation() {
$this->assertTags($result, $expected);
}

/**
* Tests displaying errors for nested entities
*
* @return void
*/
public function testFormValidationAssociated() {
TableRegistry::get('Contacts', [
'className' => __NAMESPACE__ . '\ContactsTable'
]);
$nested = new Entity(['foo' => 'bar']);
$nested->errors('foo', ['not a valid bar']);
$entity = new Entity(['nested' => $nested]);
$this->Form->create($entity, ['context' => ['table' => 'Contacts']]);

$result = $this->Form->error('nested.foo');
$this->assertEquals('<div class="error-message">not a valid bar</div>', $result);
}

/**
* testFormValidationAssociatedFirstLevel method
*
Expand Down

0 comments on commit cd9e2ca

Please sign in to comment.