aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes
diff options
context:
space:
mode:
authoraddshore <addshorewiki@gmail.com>2013-10-21 10:46:11 +0200
committeraddshore <addshorewiki@gmail.com>2013-10-21 11:28:39 +0200
commit4e941cf4ca448077286fc79a48a76d17dd549c9c (patch)
treed9fdbe451c9657a355542dc2e6cc67296092c2d9 /tests/phpunit/includes
parentb93eb55e42b8ea536711f4aacb8c8f424a59b359 (diff)
downloadmediawikicore-4e941cf4ca448077286fc79a48a76d17dd549c9c.tar.gz
mediawikicore-4e941cf4ca448077286fc79a48a76d17dd549c9c.zip
Add @covers tags for more tests
Change-Id: Iff3af78e9b41c445b7f066b6c0d0f4a87d2d6c4e
Diffstat (limited to 'tests/phpunit/includes')
-rw-r--r--tests/phpunit/includes/XmlTest.php86
-rw-r--r--tests/phpunit/includes/ZipDirectoryReaderTest.php4
-rw-r--r--tests/phpunit/includes/filebackend/FileBackendTest.php59
-rw-r--r--tests/phpunit/includes/filerepo/FileRepoTest.php8
-rw-r--r--tests/phpunit/includes/filerepo/StoreBatchTest.php12
-rw-r--r--tests/phpunit/includes/installer/OracleInstallerTest.php1
-rw-r--r--tests/phpunit/includes/site/MediaWikiSiteTest.php2
-rw-r--r--tests/phpunit/includes/site/SiteListTest.php8
-rw-r--r--tests/phpunit/includes/site/SiteSQLStoreTest.php12
-rw-r--r--tests/phpunit/includes/site/SiteTest.php30
-rw-r--r--tests/phpunit/includes/upload/UploadBaseTest.php7
11 files changed, 214 insertions, 15 deletions
diff --git a/tests/phpunit/includes/XmlTest.php b/tests/phpunit/includes/XmlTest.php
index 22948041185b..a19883257f17 100644
--- a/tests/phpunit/includes/XmlTest.php
+++ b/tests/phpunit/includes/XmlTest.php
@@ -1,8 +1,6 @@
<?php
class XmlTest extends MediaWikiTestCase {
- private static $oldLang;
- private static $oldNamespaces;
protected function setUp() {
parent::setUp();
@@ -33,6 +31,9 @@ class XmlTest extends MediaWikiTestCase {
) );
}
+ /**
+ * @covers Xml::expandAttributes
+ */
public function testExpandAttributes() {
$this->assertNull( Xml::expandAttributes( null ),
'Converting a null list of attributes'
@@ -42,11 +43,17 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::expandAttributes
+ */
public function testExpandAttributesException() {
$this->setExpectedException( 'MWException' );
Xml::expandAttributes( 'string' );
}
+ /**
+ * @covers Xml::element
+ */
function testElementOpen() {
$this->assertEquals(
'<element>',
@@ -55,6 +62,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::element
+ */
function testElementEmpty() {
$this->assertEquals(
'<element />',
@@ -63,6 +73,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::input
+ */
function testElementInputCanHaveAValueOfZero() {
$this->assertEquals(
'<input name="name" value="0" />',
@@ -71,6 +84,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::element
+ */
function testElementEscaping() {
$this->assertEquals(
'<element>hello &lt;there&gt; you &amp; you</element>',
@@ -79,12 +95,18 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::escapeTagsOnly
+ */
public function testEscapeTagsOnly() {
$this->assertEquals( '&quot;&gt;&lt;', Xml::escapeTagsOnly( '"><' ),
'replace " > and < with their HTML entitites'
);
}
+ /**
+ * @covers Xml::element
+ */
function testElementAttributes() {
$this->assertEquals(
'<element key="value" <>="&lt;&gt;">',
@@ -93,6 +115,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::openElement
+ */
function testOpenElement() {
$this->assertEquals(
'<element k="v">',
@@ -101,10 +126,16 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::closeElement
+ */
function testCloseElement() {
$this->assertEquals( '</element>', Xml::closeElement( 'element' ), 'closeElement() shortcut' );
}
+ /**
+ * @covers Xml::dateMenu
+ */
public function testDateMenu() {
$curYear = intval( gmdate( 'Y' ) );
$prevYear = $curYear - 1;
@@ -185,9 +216,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
- #
- # textarea
- #
+ /**
+ * @covers Xml::textarea
+ */
function testTextareaNoContent() {
$this->assertEquals(
'<textarea name="name" id="name" cols="40" rows="5"></textarea>',
@@ -196,6 +227,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::textarea
+ */
function testTextareaAttribs() {
$this->assertEquals(
'<textarea name="name" id="name" cols="20" rows="10">&lt;txt&gt;</textarea>',
@@ -204,9 +238,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
- #
- # input and label
- #
+ /**
+ * @covers Xml::label
+ */
function testLabelCreation() {
$this->assertEquals(
'<label for="id">name</label>',
@@ -215,6 +249,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::label
+ */
function testLabelAttributeCanOnlyBeClassOrTitle() {
$this->assertEquals(
'<label for="id">name</label>',
@@ -244,6 +281,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::languageSelector
+ */
function testLanguageSelector() {
$select = Xml::languageSelector( 'en', true, null,
array( 'id' => 'testlang' ), wfMessage( 'yourlanguage' ) );
@@ -253,9 +293,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
- #
- # JS
- #
+ /**
+ * @covers Xml::escapeJsString
+ */
function testEscapeJsStringSpecialChars() {
$this->assertEquals(
'\\\\\r\n',
@@ -264,6 +304,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarBoolean() {
$this->assertEquals(
'true',
@@ -272,6 +315,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarNull() {
$this->assertEquals(
'null',
@@ -280,6 +326,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarArray() {
$this->assertEquals(
'["a",1]',
@@ -293,6 +342,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarObject() {
$this->assertEquals(
'{"a":"a","b":1}',
@@ -301,6 +353,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarInt() {
$this->assertEquals(
'123456',
@@ -309,6 +364,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarFloat() {
$this->assertEquals(
'1.23456',
@@ -317,6 +375,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarIntString() {
$this->assertEquals(
'"123456"',
@@ -325,6 +386,9 @@ class XmlTest extends MediaWikiTestCase {
);
}
+ /**
+ * @covers Xml::encodeJsVar
+ */
function testEncodeJsVarFloatString() {
$this->assertEquals(
'"1.23456"',
diff --git a/tests/phpunit/includes/ZipDirectoryReaderTest.php b/tests/phpunit/includes/ZipDirectoryReaderTest.php
index 3fea57a0483a..59c70473230e 100644
--- a/tests/phpunit/includes/ZipDirectoryReaderTest.php
+++ b/tests/phpunit/includes/ZipDirectoryReaderTest.php
@@ -1,5 +1,9 @@
<?php
+/**
+ * @covers ZipDirectoryReader
+ * NOTE: this test is more like an integration test than a unit test
+ */
class ZipDirectoryReaderTest extends MediaWikiTestCase {
var $zipDir, $entries;
diff --git a/tests/phpunit/includes/filebackend/FileBackendTest.php b/tests/phpunit/includes/filebackend/FileBackendTest.php
index 013bbe256b8c..fcfa724fc5b1 100644
--- a/tests/phpunit/includes/filebackend/FileBackendTest.php
+++ b/tests/phpunit/includes/filebackend/FileBackendTest.php
@@ -6,7 +6,13 @@
* @group medium
*/
class FileBackendTest extends MediaWikiTestCase {
- private $backend, $multiBackend;
+
+ /** @var FileBackend */
+ private $backend;
+ /** @var FileBackendMultiWrite */
+ private $multiBackend;
+ /** @var FSFileBackend */
+ public $singleBackend;
private $filesToPrune = array();
private static $backendToUse;
@@ -85,6 +91,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testIsStoragePath
+ * @covers FileBackend::isStoragePath
*/
public function testIsStoragePath( $path, $isStorePath ) {
$this->assertEquals( $isStorePath, FileBackend::isStoragePath( $path ),
@@ -109,6 +116,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testSplitStoragePath
+ * @covers FileBackend::splitStoragePath
*/
public function testSplitStoragePath( $path, $res ) {
$this->assertEquals( $res, FileBackend::splitStoragePath( $path ),
@@ -133,6 +141,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_normalizeStoragePath
+ * @covers FileBackend::normalizeStoragePath
*/
public function testNormalizeStoragePath( $path, $res ) {
$this->assertEquals( $res, FileBackend::normalizeStoragePath( $path ),
@@ -159,6 +168,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testParentStoragePath
+ * @covers FileBackend::parentStoragePath
*/
public function testParentStoragePath( $path, $res ) {
$this->assertEquals( $res, FileBackend::parentStoragePath( $path ),
@@ -180,6 +190,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testExtensionFromPath
+ * @covers FileBackend::extensionFromPath
*/
public function testExtensionFromPath( $path, $res ) {
$this->assertEquals( $res, FileBackend::extensionFromPath( $path ),
@@ -213,6 +224,9 @@ class FileBackendTest extends MediaWikiTestCase {
$this->tearDownFiles();
}
+ /**
+ * @covers FileBackend::doOperation
+ */
private function doTestStore( $op ) {
$backendName = $this->backendClass();
@@ -284,6 +298,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testCopy
+ * @covers FileBackend::doOperation
*/
public function testCopy( $op ) {
$this->backend = $this->singleBackend;
@@ -404,6 +419,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testMove
+ * @covers FileBackend::doOperation
*/
public function testMove( $op ) {
$this->backend = $this->singleBackend;
@@ -525,6 +541,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testDelete
+ * @covers FileBackend::doOperation
*/
public function testDelete( $op, $withSource, $okStatus ) {
$this->backend = $this->singleBackend;
@@ -616,6 +633,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testDescribe
+ * @covers FileBackend::doOperation
*/
public function testDescribe( $op, $withSource, $okStatus ) {
$this->backend = $this->singleBackend;
@@ -683,6 +701,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testCreate
+ * @covers FileBackend::doOperation
*/
public function testCreate( $op, $alreadyExists, $okStatus, $newSize ) {
$this->backend = $this->singleBackend;
@@ -803,6 +822,9 @@ class FileBackendTest extends MediaWikiTestCase {
return $cases;
}
+ /**
+ * @covers FileBackend::doQuickOperations
+ */
public function testDoQuickOperations() {
$this->backend = $this->singleBackend;
$this->doTestDoQuickOperations();
@@ -1019,6 +1041,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testGetFileStat
+ * @covers FileBackend::getFileStat
*/
public function testGetFileStat( $path, $content, $alreadyExists ) {
$this->backend = $this->singleBackend;
@@ -1094,6 +1117,8 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testGetFileContents
+ * @covers FileBackend::getFileContents
+ * @covers FileBackend::getFileContentsMulti
*/
public function testGetFileContents( $source, $content ) {
$this->backend = $this->singleBackend;
@@ -1153,6 +1178,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testGetLocalCopy
+ * @covers FileBackend::getLocalCopy
*/
public function testGetLocalCopy( $source, $content ) {
$this->backend = $this->singleBackend;
@@ -1222,6 +1248,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testGetLocalReference
+ * @covers FileBackend::getLocalReference
*/
public function testGetLocalReference( $source, $content ) {
$this->backend = $this->singleBackend;
@@ -1286,6 +1313,10 @@ class FileBackendTest extends MediaWikiTestCase {
return $cases;
}
+ /**
+ * @covers FileBackend::getLocalCopy
+ * @covers FileBackend::getLocalReference
+ */
public function testGetLocalCopyAndReference404() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
@@ -1314,6 +1345,7 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testGetFileHttpUrl
+ * @covers FileBackend::getFileHttpUrl
*/
public function testGetFileHttpUrl( $source, $content ) {
$this->backend = $this->singleBackend;
@@ -1358,6 +1390,8 @@ class FileBackendTest extends MediaWikiTestCase {
/**
* @dataProvider provider_testPrepareAndClean
+ * @covers FileBackend::prepare
+ * @covers FileBackend::clean
*/
public function testPrepareAndClean( $path, $isOK ) {
$this->backend = $this->singleBackend;
@@ -1416,6 +1450,9 @@ class FileBackendTest extends MediaWikiTestCase {
$this->tearDownFiles();
}
+ /**
+ * @covers FileBackend::clean
+ */
private function doTestRecursiveClean() {
$backendName = $this->backendClass();
@@ -1462,6 +1499,9 @@ class FileBackendTest extends MediaWikiTestCase {
// @todo testSecure
+ /**
+ * @covers FileBackend::doOperations
+ */
public function testDoOperations() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
@@ -1549,6 +1589,9 @@ class FileBackendTest extends MediaWikiTestCase {
"Correct file SHA-1 of $fileC" );
}
+ /**
+ * @covers FileBackend::doOperations
+ */
public function testDoOperationsPipeline() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
@@ -1648,6 +1691,9 @@ class FileBackendTest extends MediaWikiTestCase {
"Correct file SHA-1 of $fileC" );
}
+ /**
+ * @covers FileBackend::doOperations
+ */
public function testDoOperationsFailing() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
@@ -1722,6 +1768,9 @@ class FileBackendTest extends MediaWikiTestCase {
"Correct file SHA-1 of $fileA" );
}
+ /**
+ * @covers FileBackend::getFileList
+ */
public function testGetFileList() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
@@ -1886,6 +1935,10 @@ class FileBackendTest extends MediaWikiTestCase {
}
}
+ /**
+ * @covers FileBackend::getTopDirectoryList
+ * @covers FileBackend::getDirectoryList
+ */
public function testGetDirectoryList() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
@@ -2092,6 +2145,10 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( array(), $items, "Directory listing is empty." );
}
+ /**
+ * @covers FileBackend::lockFiles
+ * @covers FileBackend::unlockFiles
+ */
public function testLockCalls() {
$this->backend = $this->singleBackend;
$this->doTestLockCalls();
diff --git a/tests/phpunit/includes/filerepo/FileRepoTest.php b/tests/phpunit/includes/filerepo/FileRepoTest.php
index 033ae0b71205..b760e26b69d2 100644
--- a/tests/phpunit/includes/filerepo/FileRepoTest.php
+++ b/tests/phpunit/includes/filerepo/FileRepoTest.php
@@ -1,8 +1,10 @@
<?php
class FileRepoTest extends MediaWikiTestCase {
+
/**
* @expectedException MWException
+ * @covers FileRepo::__construct
*/
function testFileRepoConstructionOptionCanNotBeNull() {
new FileRepo();
@@ -10,6 +12,7 @@ class FileRepoTest extends MediaWikiTestCase {
/**
* @expectedException MWException
+ * @covers FileRepo::__construct
*/
function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
new FileRepo( array() );
@@ -17,6 +20,7 @@ class FileRepoTest extends MediaWikiTestCase {
/**
* @expectedException MWException
+ * @covers FileRepo::__construct
*/
function testFileRepoConstructionOptionNeedNameKey() {
new FileRepo( array(
@@ -26,6 +30,7 @@ class FileRepoTest extends MediaWikiTestCase {
/**
* @expectedException MWException
+ * @covers FileRepo::__construct
*/
function testFileRepoConstructionOptionNeedBackendKey() {
new FileRepo( array(
@@ -33,6 +38,9 @@ class FileRepoTest extends MediaWikiTestCase {
) );
}
+ /**
+ * @covers FileRepo::__construct
+ */
function testFileRepoConstructionWithRequiredOptions() {
$f = new FileRepo( array(
'name' => 'FileRepoTestRepository',
diff --git a/tests/phpunit/includes/filerepo/StoreBatchTest.php b/tests/phpunit/includes/filerepo/StoreBatchTest.php
index 71a585ee6ede..b33c1bbb3986 100644
--- a/tests/phpunit/includes/filerepo/StoreBatchTest.php
+++ b/tests/phpunit/includes/filerepo/StoreBatchTest.php
@@ -1,10 +1,16 @@
<?php
+
/**
* @group FileRepo
* @group medium
*/
class StoreBatchTest extends MediaWikiTestCase {
+ protected $createdFiles;
+ protected $date;
+ /** @var FileRepo */
+ protected $repo;
+
protected function setUp() {
global $wgFileBackends;
parent::setUp();
@@ -60,6 +66,7 @@ class StoreBatchTest extends MediaWikiTestCase {
* @param $originalName string The title of the image
* @param $srcPath string The filepath or virtual URL
* @param $flags integer Flags to pass into repo::store().
+ * @return FileRepoStatus
*/
private function storeit( $originalName, $srcPath, $flags ) {
$hashPath = $this->repo->getHashPath( $originalName );
@@ -79,7 +86,7 @@ class StoreBatchTest extends MediaWikiTestCase {
* @param $fn string The title of the image
* @param $infn string The name of the file (in the filesystem)
* @param $otherfn string The name of the different file (in the filesystem)
- * @param $fromrepo logical 'true' if we want to copy from a virtual URL out of the Repo.
+ * @param $fromrepo bool 'true' if we want to copy from a virtual URL out of the Repo.
*/
private function storecohort( $fn, $infn, $otherfn, $fromrepo ) {
$f = $this->storeit( $fn, $infn, 0 );
@@ -116,6 +123,9 @@ class StoreBatchTest extends MediaWikiTestCase {
$this->assertEquals( $f->successCount, 0, "counts wrong {$f->successCount} {$f->failCount}" );
}
+ /**
+ * @covers FileRepo::store
+ */
public function teststore() {
global $IP;
$this->storecohort( "Test1.png", "$IP/skins/monobook/wiki.png", "$IP/skins/monobook/video.png", false );
diff --git a/tests/phpunit/includes/installer/OracleInstallerTest.php b/tests/phpunit/includes/installer/OracleInstallerTest.php
index 7c37f98fe5c5..592500d7b27a 100644
--- a/tests/phpunit/includes/installer/OracleInstallerTest.php
+++ b/tests/phpunit/includes/installer/OracleInstallerTest.php
@@ -11,6 +11,7 @@ class OracleInstallerTest extends MediaWikiTestCase {
/**
* @dataProvider provideOracleConnectStrings
+ * @covers OracleInstaller::checkConnectStringFormat
*/
function testCheckConnectStringFormat( $expected, $connectString, $msg = '' ) {
$validity = $expected ? 'should be valid' : 'should NOT be valid';
diff --git a/tests/phpunit/includes/site/MediaWikiSiteTest.php b/tests/phpunit/includes/site/MediaWikiSiteTest.php
index e0092a55a271..c5d52d338e8f 100644
--- a/tests/phpunit/includes/site/MediaWikiSiteTest.php
+++ b/tests/phpunit/includes/site/MediaWikiSiteTest.php
@@ -54,6 +54,7 @@ class MediaWikiSiteTest extends SiteTest {
/**
* @dataProvider fileUrlProvider
+ * @covers MediaWikiSite::getFileUrl
*/
public function testGetFileUrl( $url, $filePath, $pathArgument, $expected ) {
$site = new MediaWikiSite();
@@ -77,6 +78,7 @@ class MediaWikiSiteTest extends SiteTest {
/**
* @dataProvider provideGetPageUrl
+ * @covers MediaWikiSite::getPageUrl
*/
public function testGetPageUrl( $path, $page, $expected ) {
$site = new MediaWikiSite();
diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php
index bd2ae078bbfe..8af2fc1b95a1 100644
--- a/tests/phpunit/includes/site/SiteListTest.php
+++ b/tests/phpunit/includes/site/SiteListTest.php
@@ -68,6 +68,7 @@ class SiteListTest extends MediaWikiTestCase {
/**
* @dataProvider siteListProvider
* @param SiteList $sites
+ * @covers SiteList::isEmpty
*/
public function testIsEmpty( SiteList $sites ) {
$this->assertEquals( count( $sites ) === 0, $sites->isEmpty() );
@@ -76,6 +77,7 @@ class SiteListTest extends MediaWikiTestCase {
/**
* @dataProvider siteListProvider
* @param SiteList $sites
+ * @covers SiteList::getSite
*/
public function testGetSiteByGlobalId( SiteList $sites ) {
if ( $sites->isEmpty() ) {
@@ -93,6 +95,7 @@ class SiteListTest extends MediaWikiTestCase {
/**
* @dataProvider siteListProvider
* @param SiteList $sites
+ * @covers SiteList::getSiteByInternalId
*/
public function testGetSiteByInternalId( $sites ) {
/**
@@ -110,6 +113,7 @@ class SiteListTest extends MediaWikiTestCase {
/**
* @dataProvider siteListProvider
* @param SiteList $sites
+ * @covers SiteList::hasSite
*/
public function testHasGlobalId( $sites ) {
$this->assertFalse( $sites->hasSite( 'non-existing-global-id' ) );
@@ -128,6 +132,7 @@ class SiteListTest extends MediaWikiTestCase {
/**
* @dataProvider siteListProvider
* @param SiteList $sites
+ * @covers SiteList::hasInternalId
*/
public function testHasInternallId( $sites ) {
/**
@@ -145,6 +150,7 @@ class SiteListTest extends MediaWikiTestCase {
/**
* @dataProvider siteListProvider
* @param SiteList $sites
+ * @covers SiteList::getGlobalIdentifiers
*/
public function testGetGlobalIdentifiers( SiteList $sites ) {
$identifiers = $sites->getGlobalIdentifiers();
@@ -169,6 +175,8 @@ class SiteListTest extends MediaWikiTestCase {
* @since 1.21
*
* @param SiteList $list
+ * @covers SiteList::getSerializationData
+ * @covers SiteList::unserialize
*/
public function testSerialization( SiteList $list ) {
$serialization = serialize( $list );
diff --git a/tests/phpunit/includes/site/SiteSQLStoreTest.php b/tests/phpunit/includes/site/SiteSQLStoreTest.php
index cf652e957cb6..6002c1a143b5 100644
--- a/tests/phpunit/includes/site/SiteSQLStoreTest.php
+++ b/tests/phpunit/includes/site/SiteSQLStoreTest.php
@@ -32,6 +32,9 @@
*/
class SiteSQLStoreTest extends MediaWikiTestCase {
+ /**
+ * @covers SiteSQLStore::getSites
+ */
public function testGetSites() {
$expectedSites = TestSites::getSites();
TestSites::insertIntoDb();
@@ -56,6 +59,9 @@ class SiteSQLStoreTest extends MediaWikiTestCase {
}
}
+ /**
+ * @covers SiteSQLStore::saveSites
+ */
public function testSaveSites() {
$store = SiteSQLStore::newInstance();
@@ -86,6 +92,9 @@ class SiteSQLStoreTest extends MediaWikiTestCase {
$this->assertTrue( $site->getInternalId() >= 0 );
}
+ /**
+ * @covers SiteSQLStore::reset
+ */
public function testReset() {
$store1 = SiteSQLStore::newInstance();
$store2 = SiteSQLStore::newInstance();
@@ -109,6 +118,9 @@ class SiteSQLStoreTest extends MediaWikiTestCase {
$this->assertNull( $site );
}
+ /**
+ * @covers SiteSQLStore::clear
+ */
public function testClear() {
$store = SiteSQLStore::newInstance();
$this->assertTrue( $store->clear() );
diff --git a/tests/phpunit/includes/site/SiteTest.php b/tests/phpunit/includes/site/SiteTest.php
index b453e7437e09..29c1ff330860 100644
--- a/tests/phpunit/includes/site/SiteTest.php
+++ b/tests/phpunit/includes/site/SiteTest.php
@@ -38,6 +38,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getInterwikiIds
*/
public function testGetInterwikiIds( Site $site ) {
$this->assertInternalType( 'array', $site->getInterwikiIds() );
@@ -46,6 +47,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getNavigationIds
*/
public function testGetNavigationIds( Site $site ) {
$this->assertInternalType( 'array', $site->getNavigationIds() );
@@ -54,6 +56,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::addNavigationId
*/
public function testAddNavigationId( Site $site ) {
$site->addNavigationId( 'foobar' );
@@ -63,6 +66,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::addInterwikiId
*/
public function testAddInterwikiId( Site $site ) {
$site->addInterwikiId( 'foobar' );
@@ -72,6 +76,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getLanguageCode
*/
public function testGetLanguageCode( Site $site ) {
$this->assertTypeOrValue( 'string', $site->getLanguageCode(), null );
@@ -80,6 +85,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::setLanguageCode
*/
public function testSetLanguageCode( Site $site ) {
$site->setLanguageCode( 'en' );
@@ -89,6 +95,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::normalizePageName
*/
public function testNormalizePageName( Site $site ) {
$this->assertInternalType( 'string', $site->normalizePageName( 'Foobar' ) );
@@ -97,6 +104,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getGlobalId
*/
public function testGetGlobalId( Site $site ) {
$this->assertTypeOrValue( 'string', $site->getGlobalId(), null );
@@ -105,6 +113,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::setGlobalId
*/
public function testSetGlobalId( Site $site ) {
$site->setGlobalId( 'foobar' );
@@ -114,6 +123,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getType
*/
public function testGetType( Site $site ) {
$this->assertInternalType( 'string', $site->getType() );
@@ -122,6 +132,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getPath
*/
public function testGetPath( Site $site ) {
$this->assertTypeOrValue( 'string', $site->getPath( 'page_path' ), null );
@@ -132,6 +143,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::getAllPaths
*/
public function testGetAllPaths( Site $site ) {
$this->assertInternalType( 'array', $site->getAllPaths() );
@@ -140,6 +152,8 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::setPath
+ * @covers Site::removePath
*/
public function testSetAndRemovePath( Site $site ) {
$count = count( $site->getAllPaths() );
@@ -162,6 +176,9 @@ class SiteTest extends MediaWikiTestCase {
$this->assertNull( $site->getPath( 'spam' ) );
}
+ /**
+ * @covers Site::setLinkPath
+ */
public function testSetLinkPath() {
$site = new Site();
$path = "TestPath/$1";
@@ -170,6 +187,9 @@ class SiteTest extends MediaWikiTestCase {
$this->assertEquals( $path, $site->getLinkPath() );
}
+ /**
+ * @covers Site::getLinkPathType
+ */
public function testGetLinkPathType() {
$site = new Site();
@@ -182,6 +202,9 @@ class SiteTest extends MediaWikiTestCase {
$this->assertEquals( $path, $site->getLinkPath() );
}
+ /**
+ * @covers Site::setPath
+ */
public function testSetPath() {
$site = new Site();
@@ -191,6 +214,10 @@ class SiteTest extends MediaWikiTestCase {
$this->assertEquals( $path, $site->getPath( 'foo' ) );
}
+ /**
+ * @covers Site::setPath
+ * @covers Site::getProtocol
+ */
public function testProtocolRelativePath() {
$site = new Site();
@@ -228,6 +255,7 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider provideGetPageUrl
+ * @covers Site::getPageUrl
*/
public function testGetPageUrl( $path, $page, $expected ) {
$site = new Site();
@@ -252,6 +280,8 @@ class SiteTest extends MediaWikiTestCase {
/**
* @dataProvider instanceProvider
* @param Site $site
+ * @covers Site::serialize
+ * @covers Site::unserialize
*/
public function testSerialization( Site $site ) {
$this->assertInstanceOf( 'Serializable', $site );
diff --git a/tests/phpunit/includes/upload/UploadBaseTest.php b/tests/phpunit/includes/upload/UploadBaseTest.php
index 298420bc90f0..982b46b26bb0 100644
--- a/tests/phpunit/includes/upload/UploadBaseTest.php
+++ b/tests/phpunit/includes/upload/UploadBaseTest.php
@@ -1,10 +1,12 @@
<?php
+
/**
* @group Upload
*/
class UploadBaseTest extends MediaWikiTestCase {
- protected $upload;
+ /** @var UploadTestHandler */
+ protected $upload;
protected function setUp() {
global $wgHooks;
@@ -30,6 +32,7 @@ class UploadBaseTest extends MediaWikiTestCase {
* of UploadBase::getTitle() and then the actual returned title
*
* @dataProvider provideTestTitleValidation
+ * @covers UploadBase::getTitle
*/
public function testTitleValidation( $srcFilename, $dstFilename, $code, $msg ) {
/* Check the result code */
@@ -82,6 +85,7 @@ class UploadBaseTest extends MediaWikiTestCase {
/**
* Test the upload verification functions
+ * @covers UploadBase::verifyUpload
*/
public function testVerifyUpload() {
/* Setup with zero file size */
@@ -108,7 +112,6 @@ class UploadBaseTest extends MediaWikiTestCase {
*
* This method should be abstracted so we can test different settings.
*/
-
public function testMaxUploadSize() {
global $wgMaxUploadSize;
$savedGlobal = $wgMaxUploadSize; // save global