X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FHtmlTest.php;h=999e0bb56c0d0a5de825d0745baf402f1d0a8d38;hb=af80076034fb734d652eb043c523c1d8df974e51;hp=156f702c07249f4443b0127414b2e8dd019643bd;hpb=0756849eb8450909d14dcb619307bdf07f0c7fcd;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index 156f702c07..4401410ef3 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -76,6 +76,15 @@ class HtmlTest extends MediaWikiTestCase { parent::tearDown(); } + /** + * @expectedException PHPUnit_Framework_Error_Notice + * @expectedExceptionMessage given element name with space + * @covers Html::openElement + */ + public function testOpenElement() { + Html::openElement( 'span id="x"' ); + } + /** * @covers Html::element * @covers Html::rawElement @@ -152,12 +161,12 @@ class HtmlTest extends MediaWikiTestCase { * @covers Html::expandAttributes */ public function testExpandAttributesForBooleans() { - $this->assertEquals( + $this->assertSame( '', Html::expandAttributes( [ 'selected' => false ] ), 'Boolean attributes do not generates output when value is false' ); - $this->assertEquals( + $this->assertSame( '', Html::expandAttributes( [ 'selected' => null ] ), 'Boolean attributes do not generates output when value is null' @@ -203,7 +212,6 @@ class HtmlTest extends MediaWikiTestCase { } /** - * Test for Html::expandAttributes() * Please note it output a string prefixed with a space! * @covers Html::expandAttributes */ @@ -308,7 +316,7 @@ class HtmlTest extends MediaWikiTestCase { /** * How do we handle duplicate keys in HTML attributes expansion? - * We could pass a "class" the values: 'GREEN' and array( 'GREEN' => false ) + * We could pass a "class" the values: 'GREEN' and [ 'GREEN' => false ] * The latter will take precedence. * * Feature added by r96188 @@ -421,6 +429,33 @@ class HtmlTest extends MediaWikiTestCase { ), 'Basic namespace selector with a custom label but no id attribtue for the ' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '', + Html::namespaceSelector( + [ 'in-user-lang' => true ] + ), + 'Basic namespace selector in user language' + ); } /** @@ -446,6 +481,26 @@ class HtmlTest extends MediaWikiTestCase { ), 'Namespace selector namespace filtering.' ); + $this->assertEquals( + '', + Html::namespaceSelector( + [ 'exclude' => [ 0, 1, 3, 100, 101 ], 'all' => '' ] + ), + 'Namespace selector namespace filtering with empty custom "all" option.' + ); } /**