r93058 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93057‎ | r93058 | r93059 >
Date:16:27, 25 July 2011
Author:aaron
Status:ok
Tags:
Comment:
Reverted r92489 and added/use hideDeprecated() to MW test framework
Modified paths:
  • /trunk/phase3/tests/phpunit/MediaWikiTestCase.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/BlockTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
@@ -235,5 +235,16 @@
236236 public static function disableInterwikis( $prefix, &$data ) {
237237 return false;
238238 }
 239+
 240+ /**
 241+ * Don't throw a warning if $function is deprecated and called later
 242+ *
 243+ * @param $function String
 244+ * @return null
 245+ */
 246+ function hideDeprecated( $function ) {
 247+ wfSuppressWarnings();
 248+ wfDeprecated( $function );
 249+ wfRestoreWarnings();
 250+ }
239251 }
240 -
Index: trunk/phase3/tests/phpunit/includes/BlockTest.php
@@ -83,6 +83,27 @@
8484 }
8585
8686 /**
 87+ * This is the method previously used to load block info in CheckUser etc
 88+ * passing an empty value (empty string, null, etc) as the ip parameter bypasses IP lookup checks.
 89+ *
 90+ * This stopped working with r84475 and friends: regression being fixed for bug 29116.
 91+ *
 92+ * @dataProvider dataBug29116
 93+ */
 94+ function testBug29116LoadWithEmptyIp( $vagueTarget ) {
 95+ $this->hideDeprecated( 'Block::load' );
 96+
 97+ $uid = User::idFromName( 'UTBlockee' );
 98+ $this->assertTrue( ($uid > 0), 'Must be able to look up the target user during tests' );
 99+
 100+ $block = new Block();
 101+ $ok = $block->load( $vagueTarget, $uid );
 102+ $this->assertTrue( $ok, "Block->load() with empty IP and user ID '$uid' should return a block" );
 103+
 104+ $this->assertTrue( $this->block->equals( $block ), "Block->load() returns the same block as the one that was made when given empty ip param " . var_export( $vagueTarget, true ) );
 105+ }
 106+
 107+ /**
87108 * CheckUser since being changed to use Block::newFromTarget started failing
88109 * because the new function didn't accept empty strings like Block::load()
89110 * had. Regression bug 29116.
@@ -102,4 +123,3 @@
103124 );
104125 }
105126 }
106 -

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92489Removed testBug29116LoadWithEmptyIp. Fails due to wfDeprecated() call in load...aaron22:30, 18 July 2011

Status & tagging log