|
|
@@ -2355,7 +2355,10 @@ class FormHelperTest extends TestCase
|
|
|
public function testErrorMessageDisplay()
|
|
|
{
|
|
|
$this->article['errors'] = [
|
|
|
- 'Article' => ['title' => 'error message']
|
|
|
+ 'Article' => [
|
|
|
+ 'title' => 'error message',
|
|
|
+ 'content' => 'some <strong>test</strong> data with <a href="#">HTML</a> chars'
|
|
|
+ ]
|
|
|
];
|
|
|
$this->Form->create($this->article);
|
|
|
|
|
|
@@ -2394,6 +2397,58 @@ class FormHelperTest extends TestCase
|
|
|
'/div'
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
+
|
|
|
+
|
|
|
+ $result = $this->Form->input('Article.content');
|
|
|
+ $expected = [
|
|
|
+ 'div' => ['class' => 'input text error'],
|
|
|
+ 'label' => ['for' => 'article-content'],
|
|
|
+ 'Content',
|
|
|
+ '/label',
|
|
|
+ 'input' => [
|
|
|
+ 'type' => 'text', 'name' => 'Article[content]',
|
|
|
+ 'id' => 'article-content', 'class' => 'form-error'
|
|
|
+ ],
|
|
|
+ ['div' => ['class' => 'error-message']],
|
|
|
+ 'some <strong>test</strong> data with <a href="#">HTML</a> chars',
|
|
|
+ '/div',
|
|
|
+ '/div'
|
|
|
+ ];
|
|
|
+ $this->assertHtml($expected, $result);
|
|
|
+
|
|
|
+ $result = $this->Form->input('Article.content',['error' => ['escape' => true]]);
|
|
|
+ $expected = [
|
|
|
+ 'div' => ['class' => 'input text error'],
|
|
|
+ 'label' => ['for' => 'article-content'],
|
|
|
+ 'Content',
|
|
|
+ '/label',
|
|
|
+ 'input' => [
|
|
|
+ 'type' => 'text', 'name' => 'Article[content]',
|
|
|
+ 'id' => 'article-content', 'class' => 'form-error'
|
|
|
+ ],
|
|
|
+ ['div' => ['class' => 'error-message']],
|
|
|
+ 'some <strong>test</strong> data with <a href="#">HTML</a> chars',
|
|
|
+ '/div',
|
|
|
+ '/div'
|
|
|
+ ];
|
|
|
+ $this->assertHtml($expected, $result);
|
|
|
+
|
|
|
+ $result = $this->Form->input('Article.content',['error' => ['escape' => false]]);
|
|
|
+ $expected = [
|
|
|
+ 'div' => ['class' => 'input text error'],
|
|
|
+ 'label' => ['for' => 'article-content'],
|
|
|
+ 'Content',
|
|
|
+ '/label',
|
|
|
+ 'input' => [
|
|
|
+ 'type' => 'text', 'name' => 'Article[content]',
|
|
|
+ 'id' => 'article-content', 'class' => 'form-error'
|
|
|
+ ],
|
|
|
+ ['div' => ['class' => 'error-message']],
|
|
|
+ 'some <strong>test</strong> data with <a href="#">HTML</a> chars',
|
|
|
+ '/div',
|
|
|
+ '/div'
|
|
|
+ ];
|
|
|
+ $this->assertHtml($expected, $result);
|
|
|
}
|
|
|
|
|
|
/**
|