BootstrapUI\Test\TestCase\View\Helper\FormHelperTest::testHelpText PHP Method

testHelpText() public method

public testHelpText ( )
    public function testHelpText()
    {
        $this->Form->create($this->article);
        $result = $this->Form->input('title', ['help' => 'help text']);
        $expected = ['div' => ['class' => 'form-group text required'], 'label' => ['class' => 'control-label', 'for' => 'title'], 'Title', '/label', 'input' => ['type' => 'text', 'name' => 'title', 'id' => 'title', 'class' => 'form-control', 'required' => 'required'], ['div' => ['class' => 'help-block']], 'help text', '/div', '/div'];
        $this->assertHtml($expected, $result);
        $result = $this->Form->input('published', ['help' => 'help text']);
        $expected = ['div' => ['class' => 'checkbox'], 'input' => ['type' => 'hidden', 'name' => 'published', 'value' => 0], 'label' => ['for' => 'published'], ['input' => ['type' => 'checkbox', 'name' => 'published', 'id' => 'published', 'value' => 1]], 'Published', '/label', ['div' => ['class' => 'help-block']], 'help text', '/div', '/div'];
        $this->assertHtml($expected, $result);
        $this->article['errors'] = ['title' => ['error message']];
        $this->Form->create($this->article);
        $result = $this->Form->input('title', ['help' => 'help text']);
        $expected = ['div' => ['class' => 'form-group text required has-error'], 'label' => ['class' => 'control-label', 'for' => 'title'], 'Title', '/label', 'input' => ['type' => 'text', 'name' => 'title', 'id' => 'title', 'class' => 'form-control', 'required' => 'required'], ['div' => ['class' => 'help-block']], 'error message', '/div', ['div' => ['class' => 'help-block']], 'help text', '/div', '/div'];
        $this->assertHtml($expected, $result);
        $result = $this->Form->input('title', ['help' => 'help text', 'templates' => ['help' => '<div class="custom-help-block">{{content}}</div>']]);
        $expected = ['div' => ['class' => 'form-group text required has-error'], 'label' => ['class' => 'control-label', 'for' => 'title'], 'Title', '/label', 'input' => ['type' => 'text', 'name' => 'title', 'id' => 'title', 'class' => 'form-control', 'required' => 'required'], ['div' => ['class' => 'help-block']], 'error message', '/div', ['div' => ['class' => 'custom-help-block']], 'help text', '/div', '/div'];
        $this->assertHtml($expected, $result);
    }