r79164 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79163‎ | r79164 | r79165 >
Date:05:38, 29 December 2010
Author:soxred93
Status:reverted (Comments)
Tags:
Comment:
-Set configuration automatically if not set. This allows for evasion of the makefile, ergo, more control.
-Remove instances of @covers; they were breaking code-coverage
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/IPTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/phpunit.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/IPTest.php
@@ -6,7 +6,6 @@
77 class IPTest extends MediaWikiTestCase {
88 /**
99 * not sure it should be tested with boolean false. hashar 20100924
10 - * @covers IP:isIPAddress()
1110 */
1211 public function testisIPAddress() {
1312 $this->assertFalse( IP::isIPAddress( false ), 'Boolean false is not an IP' );
@@ -35,9 +34,6 @@
3635 }
3736 }
3837
39 - /**
40 - * @covers IP::isIPv6()
41 - */
4238 public function testisIPv6() {
4339 $this->assertFalse( IP::isIPv6( ':fc:100::' ), 'IPv6 starting with lone ":"' );
4440 $this->assertFalse( IP::isIPv6( 'fc:100:::' ), 'IPv6 ending with a ":::"' );
@@ -81,9 +77,6 @@
8278 $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1:e:ac:0' ) );
8379 }
8480
85 - /**
86 - * @covers IP::isIPv4()
87 - */
8881 public function testisIPv4() {
8982 $this->assertFalse( IP::isIPv4( false ), 'Boolean false is not an IP' );
9083 $this->assertFalse( IP::isIPv4( true ), 'Boolean true is not an IP' );
@@ -99,9 +92,6 @@
10093 $this->assertTrue( IP::isIPv4( '74.24.52.13/20', 'IPv4 range' ) );
10194 }
10295
103 - /**
104 - * @covers IP::isValid()
105 - */
10696 public function testValidIPs() {
10797 foreach ( range( 0, 255 ) as $i ) {
10898 $a = sprintf( "%03d", $i );
@@ -123,9 +113,6 @@
124114 }
125115 }
126116
127 - /**
128 - * @covers IP::isValid()
129 - */
130117 public function testInvalidIPs() {
131118 // Out of range...
132119 foreach ( range( 256, 999 ) as $i ) {
@@ -173,9 +160,6 @@
174161 }
175162 }
176163
177 - /**
178 - * @covers IP::isValidBlock()
179 - */
180164 public function testValidBlocks() {
181165 $valid = array(
182166 '116.17.184.5/32',
@@ -196,9 +180,6 @@
197181 }
198182 }
199183
200 - /**
201 - * @covers IP::isValidBlock()
202 - */
203184 public function testInvalidBlocks() {
204185 $invalid = array(
205186 '116.17.184.5/33',
@@ -221,7 +202,6 @@
222203
223204 /**
224205 * test wrapper around ip2long which might return -1 or false depending on PHP version
225 - * @covers IP::toUnsigned()
226206 */
227207 public function testip2longWrapper() {
228208 // fixme : add more tests ?
@@ -230,9 +210,6 @@
231211 $this->assertFalse( IP::toUnSigned( $i ) );
232212 }
233213
234 - /**
235 - * @covers IP::isPublic()
236 - */
237214 public function testPrivateIPs() {
238215 $private = array( 'fc::3', 'fc::ff', '::1', '10.0.0.1', '172.16.0.1', '192.168.0.1' );
239216 foreach ( $private as $p ) {
@@ -252,9 +229,6 @@
253230 $this->assertEquals( $expected, long2ip( $parse[0] ), "network shifting $CIDR" );
254231 }
255232
256 - /**
257 - * @covers IP::hexToQuad()
258 - */
259233 public function testHexToQuad() {
260234 $this->assertEquals( '0.0.0.1' , IP::hexToQuad( '00000001' ) );
261235 $this->assertEquals( '255.0.0.0' , IP::hexToQuad( 'FF000000' ) );
@@ -267,9 +241,6 @@
268242 $this->assertEquals( '0.0.255.0' , IP::hexToQuad( 'FF00' ) );
269243 }
270244
271 - /**
272 - * @covers IP::hexToOctet()
273 - */
274245 public function testHexToOctet() {
275246 $this->assertEquals( '0:0:0:0:0:0:0:1',
276247 IP::hexToOctet( '00000000000000000000000000000001' ) );
@@ -293,7 +264,6 @@
294265 /*
295266 * IP::parseCIDR() returns an array containing a signed IP address
296267 * representing the network mask and the bit mask.
297 - * @covers IP::parseCIDR()
298268 */
299269 function testCIDRParsing() {
300270 $this->assertFalseCIDR( '192.0.2.0' , "missing mask" );
Index: trunk/phase3/tests/phpunit/phpunit.php
@@ -14,14 +14,18 @@
1515 // Set a flag which can be used to detect when other scripts have been entered through this entry point or not
1616 define( 'MW_PHPUNIT_TEST', true );
1717
18 -$options = array( 'quiet' );
19 -
2018 // Start up MediaWiki in command-line mode
2119 require_once( "$IP/maintenance/commandLine.inc" );
2220
2321 // Assume UTC for testing purposes
2422 $wgLocaltimezone = 'UTC';
2523
 24+if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
 25+ //Hack to eliminate the need to use the Makefile (which sucks ATM)
 26+ $_SERVER['argv'][] = '--configuration';
 27+ $_SERVER['argv'][] = $IP . '/tests/phpunit/suite.xml';
 28+}
 29+
2630 require_once( 'PHPUnit/Runner/Version.php' );
2731 if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
2832 # PHPUnit 3.5.0 introduced a nice autoloader based on class name

Follow-up revisions

RevisionCommit summaryAuthorDate
r83389PHPUnit coverage comment must not have parentheses...hashar17:36, 6 March 2011
r109843Make arguments to phpunit.php work. It's hard to believe this could have been...tstarling19:06, 23 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79118Add @covers annotations to IP testsdemon18:23, 28 December 2010

Comments

#Comment by Hashar (talk | contribs)   17:39, 6 March 2011

I have revert the @covers part and fixed the issue with r83389 (see commit comment). Marking ok

Status & tagging log