r79107 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79106‎ | r79107 | r79108 >
Date:15:13, 28 December 2010
Author:soxred93
Status:resolved (Comments)
Tags:
Comment:
assertType() is deprecated, switching usages tp assertInternalType() and assertInstanceOf()
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/GlobalTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/MessageTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/api/ApiTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/ApiTest.php
@@ -70,7 +70,7 @@
7171
7272 libxml_use_internal_errors( true );
7373 $sxe = simplexml_load_string( $resp );
74 - $this->assertNotType( "bool", $sxe );
 74+ $this->assertNotInternalType( "bool", $sxe );
7575 $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
7676 }
7777
@@ -101,7 +101,7 @@
102102
103103 $result = $ret[0];
104104
105 - $this->assertNotType( "bool", $result );
 105+ $this->assertNotInternalType( "bool", $result );
106106 $a = $result["login"]["result"];
107107 $this->assertEquals( "NeedToken", $a );
108108
@@ -117,7 +117,7 @@
118118
119119 $result = $ret[0];
120120
121 - $this->assertNotType( "bool", $result );
 121+ $this->assertNotInternalType( "bool", $result );
122122 $a = $result["login"]["result"];
123123
124124 $this->assertEquals( "WrongPass", $a );
@@ -140,8 +140,8 @@
141141 );
142142
143143 $result = $ret[0];
144 - $this->assertNotType( "bool", $result );
145 - $this->assertNotType( "null", $result["login"] );
 144+ $this->assertNotInternalType( "bool", $result );
 145+ $this->assertNotInternalType( "null", $result["login"] );
146146
147147 $a = $result["login"]["result"];
148148 $this->assertEquals( "NeedToken", $a );
@@ -157,7 +157,7 @@
158158
159159 $result = $ret[0];
160160
161 - $this->assertNotType( "bool", $result );
 161+ $this->assertNotInternalType( "bool", $result );
162162 $a = $result["login"]["result"];
163163
164164 $this->assertEquals( "Success", $a );
@@ -180,9 +180,9 @@
181181
182182 libxml_use_internal_errors( true );
183183 $sxe = simplexml_load_string( $req->getContent() );
184 - $this->assertNotType( "bool", $sxe );
 184+ $this->assertNotInternalType( "bool", $sxe );
185185 $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
186 - $this->assertNotType( "null", $sxe->login[0] );
 186+ $this->assertNotInternalType( "null", $sxe->login[0] );
187187
188188 $a = $sxe->login[0]->attributes()->result[0];
189189 $this->assertEquals( ' result="NeedToken"', $a->asXML() );
@@ -220,7 +220,7 @@
221221 $req->execute();
222222 libxml_use_internal_errors( true );
223223 $sxe = simplexml_load_string( $req->getContent() );
224 - $this->assertNotType( "bool", $sxe );
 224+ $this->assertNotInternalType( "bool", $sxe );
225225 $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
226226 $a = $sxe->query[0]->pages[0]->page[0]->attributes();
227227 }
Index: trunk/phase3/tests/phpunit/includes/MessageTest.php
@@ -21,8 +21,8 @@
2222 }
2323
2424 function testKey() {
25 - $this->assertType( 'Message', wfMessage( 'mainpage' ) );
26 - $this->assertType( 'Message', wfMessage( 'i-dont-exist-evar' ) );
 25+ $this->assertInstanceOf( 'Message', wfMessage( 'mainpage' ) );
 26+ $this->assertInstanceOf( 'Message', wfMessage( 'i-dont-exist-evar' ) );
2727 $this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->text() );
2828 $this->assertEquals( '<i-dont-exist-evar>', wfMessage( 'i-dont-exist-evar' )->text() );
2929 }
Index: trunk/phase3/tests/phpunit/includes/GlobalTest.php
@@ -63,7 +63,7 @@
6464
6565 function testTime() {
6666 $start = wfTime();
67 - $this->assertType( 'float', $start );
 67+ $this->assertInternalType( 'float', $start );
6868 $end = wfTime();
6969 $this->assertTrue( $end > $start, "Time is running backwards!" );
7070 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r79177Follow up r79107 for old PHPUnit versions.platonides15:21, 29 December 2010

Comments

#Comment by Platonides (talk | contribs)   12:34, 29 December 2010

PHP Fatal error: Call to undefined method MessageTest::assertInstanceOf() in trunk/phase3/tests/phpunit/includes/MessageTest.php on line 24

#Comment by X! (talk | contribs)   15:31, 29 December 2010

r79177 is exactly the change I would have made.

(this is an argument for including PHPUnit directly in MW)

Status & tagging log