From: Antoine Musso Date: Mon, 15 Aug 2011 19:39:55 +0000 (+0000) Subject: PHPUnit test file must end with 'Test.php' X-Git-Tag: 1.31.0-rc.0~28249 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=9e2f7ebb7d466f078298fe66c0c565ff048c845e;p=lhc%2Fweb%2Fwiklou.git PHPUnit test file must end with 'Test.php' follow up r92045 --- diff --git a/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php b/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php deleted file mode 100644 index f71ace658d..0000000000 --- a/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php +++ /dev/null @@ -1,66 +0,0 @@ -assertEquals( $fullUrl, wfExpandUrl( $shortUrl, $defaultProto ), $message ); - - // Restore $wgServer - $wgServer = $oldServer; - } - - /** - * Provider of URL examples for testing wfExpandUrl() - * - * @return array - */ - public function provideExpandableUrls() { - $modes = array( 'http', 'https' ); - $servers = array( 'http' => 'http://example.com', 'https' => 'https://example.com', 'protocol-relative' => '//example.com' ); - $defaultProtos = array( 'http' => PROTO_HTTP, 'https' => PROTO_HTTPS, 'protocol-relative' => PROTO_RELATIVE, 'current' => PROTO_CURRENT ); - - $retval = array(); - foreach ( $modes as $mode ) { - $httpsMode = $mode == 'https'; - foreach ( $servers as $serverDesc => $server ) { - foreach ( $defaultProtos as $protoDesc => $defaultProto ) { - $retval[] = array( 'http://example.com', 'http://example.com', $defaultProto, $server, $httpsMode, "Testing fully qualified http URLs (no need to expand) (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); - $retval[] = array( 'https://example.com', 'https://example.com', $defaultProto, $server, $httpsMode, "Testing fully qualified https URLs (no need to expand) (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); - # Would be nice to support this, see fixme on wfExpandUrl() - $retval[] = array( "wiki/FooBar", 'wiki/FooBar', $defaultProto, $server, $httpsMode, "Test non-expandable relative URLs (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); - - // Determine expected protocol - $p = $protoDesc . ':'; // default case - if ( $protoDesc == 'protocol-relative' ) { - $p = ''; - } else if ( $protoDesc == 'current' ) { - $p = "$mode:"; - } else { - $p = $protoDesc . ':'; - } - // Determine expected server name - $srv = $serverDesc == 'protocol-relative' ? $p . $server : $server; - - $retval[] = array( "$p//wikipedia.org", '//wikipedia.org', $defaultProto, $server, $httpsMode, "Test protocol-relative URL (defaultProto: $protoDesc, wgServer: $server, current request protocol: $mode )" ); - $retval[] = array( "$srv/wiki/FooBar", '/wiki/FooBar', $defaultProto, $server, $httpsMode, "Testing expanding URL beginning with / (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); - } - } - } - return $retval; - } -} diff --git a/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php b/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php new file mode 100644 index 0000000000..f71ace658d --- /dev/null +++ b/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php @@ -0,0 +1,66 @@ +assertEquals( $fullUrl, wfExpandUrl( $shortUrl, $defaultProto ), $message ); + + // Restore $wgServer + $wgServer = $oldServer; + } + + /** + * Provider of URL examples for testing wfExpandUrl() + * + * @return array + */ + public function provideExpandableUrls() { + $modes = array( 'http', 'https' ); + $servers = array( 'http' => 'http://example.com', 'https' => 'https://example.com', 'protocol-relative' => '//example.com' ); + $defaultProtos = array( 'http' => PROTO_HTTP, 'https' => PROTO_HTTPS, 'protocol-relative' => PROTO_RELATIVE, 'current' => PROTO_CURRENT ); + + $retval = array(); + foreach ( $modes as $mode ) { + $httpsMode = $mode == 'https'; + foreach ( $servers as $serverDesc => $server ) { + foreach ( $defaultProtos as $protoDesc => $defaultProto ) { + $retval[] = array( 'http://example.com', 'http://example.com', $defaultProto, $server, $httpsMode, "Testing fully qualified http URLs (no need to expand) (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); + $retval[] = array( 'https://example.com', 'https://example.com', $defaultProto, $server, $httpsMode, "Testing fully qualified https URLs (no need to expand) (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); + # Would be nice to support this, see fixme on wfExpandUrl() + $retval[] = array( "wiki/FooBar", 'wiki/FooBar', $defaultProto, $server, $httpsMode, "Test non-expandable relative URLs (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); + + // Determine expected protocol + $p = $protoDesc . ':'; // default case + if ( $protoDesc == 'protocol-relative' ) { + $p = ''; + } else if ( $protoDesc == 'current' ) { + $p = "$mode:"; + } else { + $p = $protoDesc . ':'; + } + // Determine expected server name + $srv = $serverDesc == 'protocol-relative' ? $p . $server : $server; + + $retval[] = array( "$p//wikipedia.org", '//wikipedia.org', $defaultProto, $server, $httpsMode, "Test protocol-relative URL (defaultProto: $protoDesc, wgServer: $server, current request protocol: $mode )" ); + $retval[] = array( "$srv/wiki/FooBar", '/wiki/FooBar', $defaultProto, $server, $httpsMode, "Testing expanding URL beginning with / (defaultProto: $protoDesc , wgServer: $server, current request protocol: $mode )" ); + } + } + } + return $retval; + } +}