r92045 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92044‎ | r92045 | r92046 >
Date:01:54, 13 July 2011
Author:demon
Status:resolved
Tags:
Comment:
Add some tests for wfExpandUrl. Definitely not complete (needs some for protocol relativeness)
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php (added) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php
@@ -0,0 +1,26 @@
 2+<?php
 3+/*
 4+ * To change this template, choose Tools | Templates
 5+ * and open the template in the editor.
 6+ */
 7+
 8+class wfExpandUrl extends MediaWikiTestCase {
 9+ /** @dataProvider provideExpandableUrls */
 10+ public function testWfExpandUrl( $fullUrl, $shortUrl, $message ) {
 11+ $this->assertEquals( $fullUrl, wfExpandUrl( $shortUrl ), $message );
 12+ }
 13+
 14+ /**
 15+ * Provider of URL examples for testing wfExpandUrl()
 16+ */
 17+ public function provideExpandableUrls() {
 18+ global $wgServer;
 19+ return array(
 20+ array( "$wgServer/wiki/FooBar", '/wiki/FooBar', 'Testing expanding URL beginning with /' ),
 21+ array( 'http://example.com', 'http://example.com', 'Testing fully qualified http URLs (no need to expand)' ),
 22+ array( 'https://example.com', 'https://example.com', 'Testing fully qualified https URLs (no need to expand)' ),
 23+ # Would be nice to support this, see fixme on wfExpandUrl()
 24+ array( "wiki/FooBar", 'wiki/FooBar', "Test non-expandable relative URLs" ),
 25+ );
 26+ }
 27+}
Property changes on: trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php
___________________________________________________________________
Added: svn:eol-style
128 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r92046Forgot to change my default header, followup r92045demon01:55, 13 July 2011
r94555PHPUnit test file must end with 'Test.php'...hashar19:39, 15 August 2011

Status & tagging log