Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated test related to displaying errors in nested properties

  • Loading branch information...
commit cd9e2ca8ad6dba94a810b457b651d4ca099b71d7 1 parent 2f5499d
@lorenzo lorenzo authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/TestCase/View/Helper/FormHelperTest.php
View
18 tests/TestCase/View/Helper/FormHelperTest.php
@@ -2025,6 +2025,24 @@ public function testEmptyInputErrorValidation() {
}
/**
+ * 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
*
* test form error display with associated model.
Please sign in to comment.
Something went wrong with that request. Please try again.