MediaWiki REL1_32
HTMLFormTest.php
Go to the documentation of this file.
1<?php
2
10
11 private function newInstance() {
12 $form = new HTMLForm( [] );
13 $form->setTitle( Title::newFromText( 'Foo' ) );
14 return $form;
15 }
16
17 public function testGetHTML_empty() {
18 $form = $this->newInstance();
19 $form->prepareForm();
20 $html = $form->getHTML( false );
21 $this->assertStringStartsWith( '<form ', $html );
22 }
23
27 public function testGetHTML_noPrepare() {
28 $form = $this->newInstance();
29 $form->getHTML( false );
30 }
31
33 $form = $this->newInstance();
34 $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) );
35 }
36
38 $form = $this->newInstance();
39 $form->setAutocomplete( null );
40 $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) );
41 }
42
44 $form = $this->newInstance();
45 // Previously false was used instead of null to indicate the attribute should not be set
46 $form->setAutocomplete( false );
47 $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) );
48 }
49
50 public function testAutocompleteWhenSetToOff() {
51 $form = $this->newInstance();
52 $form->setAutocomplete( 'off' );
53 $this->assertContains( ' autocomplete="off"', $form->wrapForm( '' ) );
54 }
55
56 public function testGetPreText() {
57 $preText = 'TEST';
58 $form = $this->newInstance();
59 $form->setPreText( $preText );
60 $this->assertSame( $preText, $form->getPreText() );
61 }
62
63}
HTMLForm.
testAutocompleteWhenSetToOff()
testAutocompleteDefaultsToNull()
testGetHTML_noPrepare()
LogicException.
testAutocompleteWhenSetToFalse()
testAutocompleteWhenSetToNull()
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition HTMLForm.php:136
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:2062