array( 'request' => array( 'class' => 'yii\web\Request', 'url' => '/test', ), ), )); } public function tearDown() { Yii::$app = null; } public function testEncode() { $this->assertEquals("a<>&"'", Html::encode("a<>&\"'")); } public function testDecode() { $this->assertEquals("a<>&\"'", Html::decode("a<>&"'")); } public function testTag() { $this->assertEquals('
', Html::tag('br')); $this->assertEquals('', Html::tag('span')); $this->assertEquals('
content
', Html::tag('div', 'content')); $this->assertEquals('', Html::tag('input', '', array('type' => 'text', 'name' => 'test', 'value' => '<>'))); Html::$closeVoidElements = false; $this->assertEquals('
', Html::tag('br')); $this->assertEquals('', Html::tag('span')); $this->assertEquals('
content
', Html::tag('div', 'content')); $this->assertEquals('', Html::tag('input', '', array('type' => 'text', 'name' => 'test', 'value' => '<>'))); Html::$closeVoidElements = true; } public function testBeginTag() { $this->assertEquals('
', Html::beginTag('br')); $this->assertEquals('', Html::beginTag('span', array('id' => 'test', 'class' => 'title'))); } public function testEndTag() { $this->assertEquals('
', Html::endTag('br')); $this->assertEquals('
', Html::endTag('span')); } public function testCdata() { $data = 'test<>'; $this->assertEquals('', Html::cdata($data)); } public function testStyle() { $content = 'a <>'; $this->assertEquals("", Html::style($content)); $this->assertEquals("", Html::style($content, array('type' => 'text/less'))); } public function testScript() { $content = 'a <>'; $this->assertEquals("", Html::script($content)); $this->assertEquals("", Html::script($content, array('type' => 'text/js'))); } public function testCssFile() { $this->assertEquals('', Html::cssFile('http://example.com')); $this->assertEquals('', Html::cssFile('')); } public function testJsFile() { $this->assertEquals('', Html::jsFile('http://example.com')); $this->assertEquals('', Html::jsFile('')); } public function testBeginForm() { $this->assertEquals('
', Html::beginForm()); $this->assertEquals('', Html::beginForm('/example', 'get')); $hiddens = array( '', '', ); $this->assertEquals('' . "\n" . implode("\n", $hiddens), Html::beginForm('/example?id=1&title=%3C', 'get')); } public function testEndForm() { $this->assertEquals('
', Html::endForm()); } public function testA() { $this->assertEquals('something<>', Html::a('something<>')); $this->assertEquals('something', Html::a('something', '/example')); $this->assertEquals('something', Html::a('something', '')); } public function testMailto() { $this->assertEquals('test<>', Html::mailto('test<>')); $this->assertEquals('test<>', Html::mailto('test<>', 'test>')); } public function testImg() { $this->assertEquals('', Html::img('/example')); $this->assertEquals('', Html::img('')); $this->assertEquals('something', Html::img('/example', array('alt' => 'something', 'width' => 10))); } public function testLabel() { $this->assertEquals('', Html::label('something<>')); $this->assertEquals('', Html::label('something<>', 'a')); $this->assertEquals('', Html::label('something<>', 'a', array('class' => 'test'))); } public function testButton() { $this->assertEquals('', Html::button()); $this->assertEquals('', Html::button('test', 'value', 'content<>')); $this->assertEquals('', Html::button('test', 'value', 'content<>', array('type' => 'submit', 'class' => "t"))); } public function testSubmitButton() { $this->assertEquals('', Html::submitButton()); $this->assertEquals('', Html::submitButton('test', 'value', 'content<>', array('class' => 't'))); } public function testResetButton() { $this->assertEquals('', Html::resetButton()); $this->assertEquals('', Html::resetButton('test', 'value', 'content<>', array('class' => 't'))); } public function testInput() { $this->assertEquals('', Html::input('text')); $this->assertEquals('', Html::input('text', 'test', 'value', array('class' => 't'))); } public function testButtonInput() { } public function testSubmitInput() { } public function testResetInput() { } public function testTextInput() { } public function testHiddenInput() { } public function testPasswordInput() { } public function testFileInput() { } public function testTextarea() { } public function testRadio() { } public function testCheckbox() { } public function testDropDownList() { } public function testListBox() { } public function testCheckboxList() { } public function testRadioList() { } public function testRenderOptions() { } public function testRenderAttributes() { } public function testUrl() { } }