Skip to content
Permalink
Browse files

Updated test related to displaying errors in nested properties

  • Loading branch information...
lorenzo committed Feb 27, 2014
1 parent 2f5499d commit cd9e2ca8ad6dba94a810b457b651d4ca099b71d7
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/TestCase/View/Helper/FormHelperTest.php
@@ -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
*

0 comments on commit cd9e2ca

Please sign in to comment.
You can’t perform that action at this time.