r76798 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76797‎ | r76798 | r76799 >
Date:15:10, 16 November 2010
Author:demon
Status:ok
Tags:
Comment:
More is_a() -> instanceof
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/includes/HttpTest.php (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit/includes/LicensesTest.php (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit/includes/api/ApiUploadTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/includes/LicensesTest.php
@@ -9,6 +9,6 @@
1010 ";
1111
1212 $lc = new Licenses( array( 'licenses' => $str ) );
13 - $this->assertTrue( is_a( $lc, 'Licenses' ), 'Correct class' );
 13+ $this->assertThat( $r, $this->isInstanceOf( 'Licenses' ) );
1414 }
1515 }
Index: trunk/phase3/maintenance/tests/phpunit/includes/HttpTest.php
@@ -119,7 +119,7 @@
120120
121121 $r = MWHttpRequest::factory( "http://www.example.com/this-file-does-not-exist" );
122122 $er = $r->execute();
123 - if ( is_a( $r, 'PhpHttpRequest' ) && version_compare( '5.2.10', phpversion(), '>' ) ) {
 123+ if ( $r instanceof PhpHttpRequest && version_compare( '5.2.10', phpversion(), '>' ) ) {
124124 $this->assertRegexp( "/HTTP request failed/", $er->getWikiText() );
125125 } else {
126126 $this->assertRegexp( "/404 Not Found/", $er->getWikiText() );
@@ -538,7 +538,7 @@
539539 $jar = $r->getCookieJar();
540540 $this->assertThat( $jar, $this->isInstanceOf( 'CookieJar' ) );
541541
542 - if ( is_a( $r, 'PhpHttpRequest' ) && version_compare( '5.1.7', phpversion(), '>' ) ) {
 542+ if ( $r instanceof PhpHttpRequest && version_compare( '5.1.7', phpversion(), '>' ) ) {
543543 $this->markTestSkipped( 'Redirection fails or crashes PHP on 5.1.6 and prior' );
544544 }
545545 $serialized = $jar->serializeToHttpRequest( "/search?q=test", "www.php.net" );
Index: trunk/phase3/maintenance/tests/phpunit/includes/api/ApiUploadTest.php
@@ -596,7 +596,7 @@
597597 // see if it now doesn't exist; reload
598598 $title = Title::newFromText( $fileName, NS_FILE );
599599 }
600 - return ! ( $title && is_a( $title, 'Title' ) && $title->exists() );
 600+ return ! ( $title && $title instanceof Title && $title->exists() );
601601 }
602602
603603 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r76804Fix copy+paste error from r76798demon16:02, 16 November 2010

Status & tagging log