From fa0ce7197addcecbc97398c83b7077275c46c623 Mon Sep 17 00:00:00 2001 From: X! Date: Wed, 29 Dec 2010 05:38:11 +0000 Subject: [PATCH] -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 --- tests/phpunit/includes/IPTest.php | 30 ------------------------------ tests/phpunit/phpunit.php | 8 ++++++-- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/tests/phpunit/includes/IPTest.php b/tests/phpunit/includes/IPTest.php index f811bf1333..695c656979 100644 --- a/tests/phpunit/includes/IPTest.php +++ b/tests/phpunit/includes/IPTest.php @@ -6,7 +6,6 @@ class IPTest extends MediaWikiTestCase { /** * not sure it should be tested with boolean false. hashar 20100924 - * @covers IP:isIPAddress() */ public function testisIPAddress() { $this->assertFalse( IP::isIPAddress( false ), 'Boolean false is not an IP' ); @@ -35,9 +34,6 @@ class IPTest extends MediaWikiTestCase { } } - /** - * @covers IP::isIPv6() - */ public function testisIPv6() { $this->assertFalse( IP::isIPv6( ':fc:100::' ), 'IPv6 starting with lone ":"' ); $this->assertFalse( IP::isIPv6( 'fc:100:::' ), 'IPv6 ending with a ":::"' ); @@ -81,9 +77,6 @@ class IPTest extends MediaWikiTestCase { $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1:e:ac:0' ) ); } - /** - * @covers IP::isIPv4() - */ public function testisIPv4() { $this->assertFalse( IP::isIPv4( false ), 'Boolean false is not an IP' ); $this->assertFalse( IP::isIPv4( true ), 'Boolean true is not an IP' ); @@ -99,9 +92,6 @@ class IPTest extends MediaWikiTestCase { $this->assertTrue( IP::isIPv4( '74.24.52.13/20', 'IPv4 range' ) ); } - /** - * @covers IP::isValid() - */ public function testValidIPs() { foreach ( range( 0, 255 ) as $i ) { $a = sprintf( "%03d", $i ); @@ -123,9 +113,6 @@ class IPTest extends MediaWikiTestCase { } } - /** - * @covers IP::isValid() - */ public function testInvalidIPs() { // Out of range... foreach ( range( 256, 999 ) as $i ) { @@ -173,9 +160,6 @@ class IPTest extends MediaWikiTestCase { } } - /** - * @covers IP::isValidBlock() - */ public function testValidBlocks() { $valid = array( '116.17.184.5/32', @@ -196,9 +180,6 @@ class IPTest extends MediaWikiTestCase { } } - /** - * @covers IP::isValidBlock() - */ public function testInvalidBlocks() { $invalid = array( '116.17.184.5/33', @@ -221,7 +202,6 @@ class IPTest extends MediaWikiTestCase { /** * test wrapper around ip2long which might return -1 or false depending on PHP version - * @covers IP::toUnsigned() */ public function testip2longWrapper() { // fixme : add more tests ? @@ -230,9 +210,6 @@ class IPTest extends MediaWikiTestCase { $this->assertFalse( IP::toUnSigned( $i ) ); } - /** - * @covers IP::isPublic() - */ public function testPrivateIPs() { $private = array( 'fc::3', 'fc::ff', '::1', '10.0.0.1', '172.16.0.1', '192.168.0.1' ); foreach ( $private as $p ) { @@ -252,9 +229,6 @@ class IPTest extends MediaWikiTestCase { $this->assertEquals( $expected, long2ip( $parse[0] ), "network shifting $CIDR" ); } - /** - * @covers IP::hexToQuad() - */ public function testHexToQuad() { $this->assertEquals( '0.0.0.1' , IP::hexToQuad( '00000001' ) ); $this->assertEquals( '255.0.0.0' , IP::hexToQuad( 'FF000000' ) ); @@ -267,9 +241,6 @@ class IPTest extends MediaWikiTestCase { $this->assertEquals( '0.0.255.0' , IP::hexToQuad( 'FF00' ) ); } - /** - * @covers IP::hexToOctet() - */ public function testHexToOctet() { $this->assertEquals( '0:0:0:0:0:0:0:1', IP::hexToOctet( '00000000000000000000000000000001' ) ); @@ -293,7 +264,6 @@ class IPTest extends MediaWikiTestCase { /* * IP::parseCIDR() returns an array containing a signed IP address * representing the network mask and the bit mask. - * @covers IP::parseCIDR() */ function testCIDRParsing() { $this->assertFalseCIDR( '192.0.2.0' , "missing mask" ); diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 2b3069dd9e..3b8795a2fa 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -14,14 +14,18 @@ $IP = dirname( dirname( dirname( __FILE__ ) ) ); // Set a flag which can be used to detect when other scripts have been entered through this entry point or not define( 'MW_PHPUNIT_TEST', true ); -$options = array( 'quiet' ); - // Start up MediaWiki in command-line mode require_once( "$IP/maintenance/commandLine.inc" ); // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; +if( !in_array( '--configuration', $_SERVER['argv'] ) ) { + //Hack to eliminate the need to use the Makefile (which sucks ATM) + $_SERVER['argv'][] = '--configuration'; + $_SERVER['argv'][] = $IP . '/tests/phpunit/suite.xml'; +} + require_once( 'PHPUnit/Runner/Version.php' ); if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) { # PHPUnit 3.5.0 introduced a nice autoloader based on class name -- 2.20.1