| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace Tools\Test\TestCase\View\Helper;
- use Cake\Core\Configure;
- use Cake\View\View;
- use Tools\TestSuite\TestCase;
- use Tools\View\Helper\FormHelper;
- /**
- * FormHelper tests
- */
- class FormHelperTest extends TestCase {
- /**
- * @var \Tools\View\Helper\FormHelper
- */
- public $Form;
- /**
- * @return void
- */
- public function setUp(): void {
- parent::setUp();
- Configure::write('App.fullBaseUrl', 'http://foo.bar');
- 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->assertStringNotContainsString($expected, $result);
- Configure::write('FormConfig.novalidate', true);
- $this->Form = new FormHelper($this->View);
- $result = $this->Form->create();
- $this->assertStringContainsString($expected, $result);
- $result = $this->Form->create(null, ['novalidate' => false]);
- $this->assertStringNotContainsString($expected, $result);
- }
- }
|