| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace Tools\TestCase\View\Helper;
- use Cake\Core\Configure;
- use Cake\Routing\Router;
- use Cake\View\View;
- use Tools\TestSuite\TestCase;
- use Tools\View\Helper\FormHelper;
- /**
- * FormHelper tests
- */
- class FormHelperTest extends TestCase {
- public $Form;
- public function setUp() {
- parent::setUp();
- Configure::delete('FormConfig');
- $this->View = new View(null);
- $this->Form = new FormHelper($this->View);
- }
- /**
- * test novalidate for create
- *
- * @return void
- */
- public function testCreate() {
- $expected = 'novalidate="novalidate"';
- $result = $this->Form->create();
- $this->assertNotContains($expected, $result);
- Configure::write('FormConfig.novalidate', true);
- $this->Form = new FormHelper($this->View);
- $result = $this->Form->create();
- $this->assertContains($expected, $result);
- $result = $this->Form->create(null, ['novalidate' => false]);
- $this->assertNotContains($expected, $result);
- }
- }
|