<?php
+/**
+ * @covers Licenses
+ */
class LicensesTest extends MediaWikiTestCase {
public function testLicenses() {
return array( $t, $po );
}
+ /**
+ * @covers LinksUpdate::addLink
+ */
public function testUpdate_pagelinks() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
), $update->getRemovedLinks() );
}
+ /**
+ * @covers LinksUpdate::addExternalLink
+ */
public function testUpdate_externallinks() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
) );
}
+ /**
+ * @covers LinksUpdate::addCategory
+ */
public function testUpdate_categorylinks() {
$this->setMwGlobals( 'wgCategoryCollation', 'uppercase' );
) );
}
+ /**
+ * @covers LinksUpdate::addInterwikiLink
+ */
public function testUpdate_iwlinks() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
) );
}
+ /**
+ * @covers LinksUpdate::addTemplate
+ */
public function testUpdate_templatelinks() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
) );
}
+ /**
+ * @covers LinksUpdate::addImage
+ */
public function testUpdate_imagelinks() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
) );
}
+ /**
+ * @covers LinksUpdate::addLanguageLink
+ */
public function testUpdate_langlinks() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
) );
}
+ /**
+ * @covers LinksUpdate::setProperty
+ */
public function testUpdate_page_props() {
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
/**
* These tests should work regardless of $wgCapitalLinks
* @group Database
+ * @todo Split tests into providers and test methods
*/
class LocalFileTest extends MediaWikiTestCase {
$this->file_lc = $this->repo_lc->newFile( 'test!' );
}
+ /**
+ * @covers File::getHashPath
+ */
public function testGetHashPath() {
$this->assertEquals( '', $this->file_hl0->getHashPath() );
$this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() );
$this->assertEquals( 'c/c4/', $this->file_lc->getHashPath() );
}
+ /**
+ * @covers File::getRel
+ */
public function testGetRel() {
$this->assertEquals( 'Test!', $this->file_hl0->getRel() );
$this->assertEquals( 'a/a2/Test!', $this->file_hl2->getRel() );
$this->assertEquals( 'c/c4/test!', $this->file_lc->getRel() );
}
+ /**
+ * @covers File::getUrlRel
+ */
public function testGetUrlRel() {
$this->assertEquals( 'Test%21', $this->file_hl0->getUrlRel() );
$this->assertEquals( 'a/a2/Test%21', $this->file_hl2->getUrlRel() );
$this->assertEquals( 'c/c4/test%21', $this->file_lc->getUrlRel() );
}
+ /**
+ * @covers File::getArchivePath
+ */
public function testGetArchivePath() {
$this->assertEquals( 'mwstore://local-backend/test-public/archive', $this->file_hl0->getArchivePath() );
$this->assertEquals( 'mwstore://local-backend/test-public/archive/a/a2', $this->file_hl2->getArchivePath() );
$this->assertEquals( 'mwstore://local-backend/test-public/archive/a/a2/!', $this->file_hl2->getArchivePath( '!' ) );
}
+ /**
+ * @covers File::getThumbPath
+ */
public function testGetThumbPath() {
$this->assertEquals( 'mwstore://local-backend/test-thumb/Test!', $this->file_hl0->getThumbPath() );
$this->assertEquals( 'mwstore://local-backend/test-thumb/a/a2/Test!', $this->file_hl2->getThumbPath() );
$this->assertEquals( 'mwstore://local-backend/test-thumb/a/a2/Test!/x', $this->file_hl2->getThumbPath( 'x' ) );
}
+ /**
+ * @covers File::getArchiveUrl
+ */
public function testGetArchiveUrl() {
$this->assertEquals( '/testurl/archive', $this->file_hl0->getArchiveUrl() );
$this->assertEquals( '/testurl/archive/a/a2', $this->file_hl2->getArchiveUrl() );
$this->assertEquals( '/testurl/archive/a/a2/%21', $this->file_hl2->getArchiveUrl( '!' ) );
}
+ /**
+ * @covers File::getThumbUrl
+ */
public function testGetThumbUrl() {
$this->assertEquals( '/testurl/thumb/Test%21', $this->file_hl0->getThumbUrl() );
$this->assertEquals( '/testurl/thumb/a/a2/Test%21', $this->file_hl2->getThumbUrl() );
$this->assertEquals( '/testurl/thumb/a/a2/Test%21/x', $this->file_hl2->getThumbUrl( 'x' ) );
}
+ /**
+ * @covers File::getArchiveVirtualUrl
+ */
public function testGetArchiveVirtualUrl() {
$this->assertEquals( 'mwrepo://test/public/archive', $this->file_hl0->getArchiveVirtualUrl() );
$this->assertEquals( 'mwrepo://test/public/archive/a/a2', $this->file_hl2->getArchiveVirtualUrl() );
$this->assertEquals( 'mwrepo://test/public/archive/a/a2/%21', $this->file_hl2->getArchiveVirtualUrl( '!' ) );
}
+ /**
+ * @covers File::getThumbVirtualUrl
+ */
public function testGetThumbVirtualUrl() {
$this->assertEquals( 'mwrepo://test/thumb/Test%21', $this->file_hl0->getThumbVirtualUrl() );
$this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21', $this->file_hl2->getThumbVirtualUrl() );
$this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21/%21', $this->file_hl2->getThumbVirtualUrl( '!' ) );
}
+ /**
+ * @covers File::getUrl
+ */
public function testGetUrl() {
$this->assertEquals( '/testurl/Test%21', $this->file_hl0->getUrl() );
$this->assertEquals( '/testurl/a/a2/Test%21', $this->file_hl2->getUrl() );
}
+ /**
+ * @covers ::wfLocalFile
+ */
public function testWfLocalFile() {
$file = wfLocalFile( "File:Some_file_that_probably_doesn't exist.png" );
$this->assertThat( $file, $this->isInstanceOf( 'LocalFile' ), 'wfLocalFile() returns LocalFile for valid Titles' );
<?php
+/**
+ * @covers LocalisationCache
+ */
class LocalisationCacheTest extends MediaWikiTestCase {
public function testPuralRulesFallback() {
$cache = Language::getLocalisationCache();
/**
* @dataProvider provideMinifyCases
+ * @covers CSSMin::minify
*/
public function testMinify( $code, $expectedOutput ) {
$minified = CSSMin::minify( $code );
/**
* @dataProvider provideRemapCases
+ * @covers CSSMin::remap
*/
public function testRemap( $message, $params, $expectedOutput ) {
$remapped = call_user_func_array( 'CSSMin::remap', $params );
*
* @group Broken
* @dataProvider provideStringCases
+ * @covers CSSMin::remap
*/
public function testMinifyWithCSSStringValues( $code, $expectedOutput ) {
$this->testMinifyOutput( $code, $expectedOutput );
* @since 1.20
*
* @param array $elements
+ *
+ * @covers GenericArrayObject::__construct
*/
public function testConstructor( array $elements ) {
$arrayObject = $this->getNew( $elements );
* @since 1.20
*
* @param array $elements
+ *
+ * @covers GenericArrayObject::isEmpty
*/
public function testIsEmpty( array $elements ) {
$arrayObject = $this->getNew( $elements );
* @since 1.20
*
* @param GenericArrayObject $list
+ *
+ * @covers GenericArrayObject::offsetUnset
*/
public function testUnset( GenericArrayObject $list ) {
if ( $list->isEmpty() ) {
* @since 1.20
*
* @param array $elements
+ *
+ * @covers GenericArrayObject::append
*/
public function testAppend( array $elements ) {
$list = $this->getNew();
* @since 1.20
*
* @param callback $function
+ *
+ * @covers GenericArrayObject::getObjectType
*/
protected function checkTypeChecks( $function ) {
$excption = null;
* @since 1.20
*
* @param array $elements
+ *
+ * @covers GenericArrayObject::offsetSet
*/
public function testOffsetSet( array $elements ) {
if ( $elements === array() ) {
* @since 1.21
*
* @param GenericArrayObject $list
+ *
+ * @covers GenericArrayObject::getSerializationData
+ * @covers GenericArrayObject::serialize
+ * @covers GenericArrayObject::unserialize
*/
public function testSerialization( GenericArrayObject $list ) {
$serialization = serialize( $list );
/**
* Tests for IEUrlExtension::findIE6Extension
+ * @todo tests below for findIE6Extension should be split into...
+ * ...a dataprovider and test method.
*/
class IEUrlExtensionTest extends MediaWikiTestCase {
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testSimple() {
$this->assertEquals(
'y',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testSimpleNoExt() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testEmpty() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testQuestionMark() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testExtQuestionMark() {
$this->assertEquals(
'x',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testQuestionMarkExt() {
$this->assertEquals(
'x',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testInvalidChar() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testInvalidCharThenExtension() {
$this->assertEquals(
'x',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testMultipleQuestionMarks() {
$this->assertEquals(
'c',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testExeException() {
$this->assertEquals(
'd',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testExeException2() {
$this->assertEquals(
'exe',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testHash() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testHash2() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testDotAtEnd() {
$this->assertEquals(
'',
);
}
+ /**
+ * @covers IEUrlExtension::findIE6Extension
+ */
public function testTwoDots() {
$this->assertEquals(
'z',
/**
* @dataProvider provideCases
+ * @covers JavaScriptMinifier::minify
*/
public function testJavaScriptMinifierOutput( $code, $expectedOutput ) {
$minified = JavaScriptMinifier::minify( $code );
/**
* @dataProvider provideBug32548
+ * @covers JavaScriptMinifier::minify
*/
public function testBug32548Exponent( $num ) {
// Long line breaking was being incorrectly done between the base and
return $logEntry;
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ */
public function testNormalLogParams() {
$entry = $this->newLogEntry( 'test', array() );
$formatter = LogFormatter::newFromEntry( $entry );
$this->assertEquals( $titleLink, $paramsWithoutTools[2]['raw'] );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypeRaw() {
$params = array( '4:raw:raw' => Linker::link( $this->title, null, array(), array() ) );
$expected = Linker::link( $this->title, null, array(), array() );
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypeMsg() {
$params = array( '4:msg:msg' => 'log-description-phpunit' );
$expected = wfMessage( 'log-description-phpunit' )->text();
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypeMsgContent() {
$params = array( '4:msg-content:msgContent' => 'log-description-phpunit' );
$expected = wfMessage( 'log-description-phpunit' )->inContentLanguage()->text();
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypeNumber() {
global $wgLang;
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypeUserLink() {
$params = array( '4:user-link:userLink' => $this->user->getName() );
$expected = Linker::userLink(
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypeTitleLink() {
$params = array( '4:title-link:titleLink' => $this->title->getText() );
$expected = Linker::link( $this->title, null, array(), array() );
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getActionText
+ */
public function testLogParamsTypePlain() {
$params = array( '4:plain:plain' => 'Some plain text' );
$expected = 'Some plain text';
$this->assertEquals( $expected, $logParam );
}
+ /**
+ * @covers LogFormatter::newFromEntry
+ * @covers LogFormatter::getComment
+ */
public function testLogComment() {
$entry = $this->newLogEntry( 'test', array() );
$formatter = LogFormatter::newFromEntry( $entry );
<?php
+
+/**
+ * @covers Exif
+ */
class ExifTest extends MediaWikiTestCase {
/** @var string */