r111455 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111454‎ | r111455 | r111456 >
Date:09:59, 14 February 2012
Author:hashar
Status:ok
Tags:
Comment:
split ns selector tests for filter / disable options

ping r111376
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/HtmlTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/HtmlTest.php
@@ -265,19 +265,12 @@
266266 ),
267267 'Basic namespace selector with custom values'
268268 );
269 - $immovable = array();
270 - $namespaces = $wgContLang->getNamespaces();
271 - foreach ( $namespaces as $nsId => $nsName ) {
272 - if ( !MWNamespace::isMovable( intval( $nsId ) ) ) {
273 - $immovable[] = $nsId;
274 - }
275269 }
276 - $this->assertEquals(
277 - '<select id="namespace" name="namespace">' . "\n" .
278 -'<option value="0">(Main)</option>' . "\n" .
279 -'<option value="1">Talk</option>' . "\n" .
 270+
 271+ function testCanFilterOutNamespaces() {
 272+ $this->assertEquals(
 273+'<select id="namespace" name="namespace">' . "\n" .
280274 '<option value="2">User</option>' . "\n" .
281 -'<option value="3">User talk</option>' . "\n" .
282275 '<option value="4">MyWiki</option>' . "\n" .
283276 '<option value="5">MyWiki Talk</option>' . "\n" .
284277 '<option value="6">File</option>' . "\n" .
@@ -286,14 +279,41 @@
287280 '<option value="9">MediaWiki talk</option>' . "\n" .
288281 '<option value="10">Template</option>' . "\n" .
289282 '<option value="11">Template talk</option>' . "\n" .
290 -'<option disabled="" value="14">Category</option>' . "\n" .
 283+'<option value="14">Category</option>' . "\n" .
291284 '<option value="15">Category talk</option>' . "\n" .
292285 '</select>',
293286 Html::namespaceSelector(
294 - array( 'exclude' => array( 100, 101 ), 'disable' => $immovable )
 287+ array( 'exclude' => array( 0, 1, 3, 100, 101 ) )
295288 ),
296 - 'Namespace selector without the custom namespace and immovable namespaces disabled.'
 289+ 'Namespace selector namespace filtering.'
297290 );
 291+ }
 292+
 293+ function testCanDisableANamespaces() {
 294+ $this->assertEquals(
 295+'<select id="namespace" name="namespace">' . "\n" .
 296+'<option disabled="" value="0">(Main)</option>' . "\n" .
 297+'<option disabled="" value="1">Talk</option>' . "\n" .
 298+'<option disabled="" value="2">User</option>' . "\n" .
 299+'<option disabled="" value="3">User talk</option>' . "\n" .
 300+'<option disabled="" value="4">MyWiki</option>' . "\n" .
 301+'<option value="5">MyWiki Talk</option>' . "\n" .
 302+'<option value="6">File</option>' . "\n" .
 303+'<option value="7">File talk</option>' . "\n" .
 304+'<option value="8">MediaWiki</option>' . "\n" .
 305+'<option value="9">MediaWiki talk</option>' . "\n" .
 306+'<option value="10">Template</option>' . "\n" .
 307+'<option value="11">Template talk</option>' . "\n" .
 308+'<option value="14">Category</option>' . "\n" .
 309+'<option value="15">Category talk</option>' . "\n" .
 310+'<option value="100">Custom</option>' . "\n" .
 311+'<option value="101">Custom talk</option>' . "\n" .
 312+'</select>',
 313+ Html::namespaceSelector( array(
 314+ 'disable' => array( 0, 1, 2, 3, 4 )
 315+ ) ),
 316+ 'Namespace selector namespace disabling'
 317+ );
298318 }
299319
300320 function testNamespaceSelectorIdAndNameDefaultsAttributes() {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111376[Html] Follow-up r109990: Add support for excluding and disabling optionskrinkle15:08, 13 February 2012

Status & tagging log