MediaWiki REL1_31
HTMLFormTest.php
Go to the documentation of this file.
1<?php
2
11
12 private function newInstance() {
13 $form = new HTMLForm( [] );
14 $form->setTitle( Title::newFromText( 'Foo' ) );
15 return $form;
16 }
17
18 public function testGetHTML_empty() {
19 $form = $this->newInstance();
20 $form->prepareForm();
21 $html = $form->getHTML( false );
22 $this->assertStringStartsWith( '<form ', $html );
23 }
24
28 public function testGetHTML_noPrepare() {
29 $form = $this->newInstance();
30 $form->getHTML( false );
31 }
32
34 $form = $this->newInstance();
35 $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) );
36 }
37
39 $form = $this->newInstance();
40 $form->setAutocomplete( null );
41 $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) );
42 }
43
45 $form = $this->newInstance();
46 // Previously false was used instead of null to indicate the attribute should not be set
47 $form->setAutocomplete( false );
48 $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) );
49 }
50
51 public function testAutocompleteWhenSetToOff() {
52 $form = $this->newInstance();
53 $form->setAutocomplete( 'off' );
54 $this->assertContains( ' autocomplete="off"', $form->wrapForm( '' ) );
55 }
56
57}
testAutocompleteWhenSetToOff()
testAutocompleteDefaultsToNull()
testGetHTML_noPrepare()
LogicException.
testAutocompleteWhenSetToFalse()
testAutocompleteWhenSetToNull()
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition HTMLForm.php:130
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition hooks.txt:2013