summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/site
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/site')
-rw-r--r--tests/phpunit/includes/site/MediaWikiSiteTest.php5
-rw-r--r--tests/phpunit/includes/site/SiteListTest.php9
-rw-r--r--tests/phpunit/includes/site/SiteSQLStoreTest.php13
-rw-r--r--tests/phpunit/includes/site/SiteTest.php33
-rw-r--r--tests/phpunit/includes/site/TestSites.php1
5 files changed, 54 insertions, 7 deletions
diff --git a/tests/phpunit/includes/site/MediaWikiSiteTest.php b/tests/phpunit/includes/site/MediaWikiSiteTest.php
index 0cecdeea..c5d52d33 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();
@@ -62,7 +63,7 @@ class MediaWikiSiteTest extends SiteTest {
$this->assertEquals( $expected, $site->getFileUrl( $pathArgument ) );
}
- public function provideGetPageUrl() {
+ public static function provideGetPageUrl() {
return array(
// path, page, expected substring
array( 'http://acme.test/wiki/$1', 'Berlin', '/wiki/Berlin' ),
@@ -77,6 +78,7 @@ class MediaWikiSiteTest extends SiteTest {
/**
* @dataProvider provideGetPageUrl
+ * @covers MediaWikiSite::getPageUrl
*/
public function testGetPageUrl( $path, $page, $expected ) {
$site = new MediaWikiSite();
@@ -85,5 +87,4 @@ class MediaWikiSiteTest extends SiteTest {
$this->assertContains( $path, $site->getPageUrl() );
$this->assertContains( $expected, $site->getPageUrl( $page ) );
}
-
}
diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php
index c3298397..8af2fc1b 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 );
@@ -186,5 +194,4 @@ class SiteListTest extends MediaWikiTestCase {
$this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) );
}
}
-
}
diff --git a/tests/phpunit/includes/site/SiteSQLStoreTest.php b/tests/phpunit/includes/site/SiteSQLStoreTest.php
index cf4ce945..6002c1a1 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() );
@@ -119,5 +131,4 @@ class SiteSQLStoreTest extends MediaWikiTestCase {
$sites = $store->getSites();
$this->assertEquals( 0, $sites->count() );
}
-
}
diff --git a/tests/phpunit/includes/site/SiteTest.php b/tests/phpunit/includes/site/SiteTest.php
index d20e2a52..29c1ff33 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();
@@ -201,7 +228,7 @@ class SiteTest extends MediaWikiTestCase {
$this->assertEquals( '', $site->getProtocol() );
}
- public function provideGetPageUrl() {
+ public static function provideGetPageUrl() {
//NOTE: the assumption that the URL is built by replacing $1
// with the urlencoded version of $page
// is true for Site but not guaranteed for subclasses.
@@ -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 );
@@ -263,5 +293,4 @@ class SiteTest extends MediaWikiTestCase {
$this->assertEquals( $serialization, serialize( $newInstance ) );
}
-
}
diff --git a/tests/phpunit/includes/site/TestSites.php b/tests/phpunit/includes/site/TestSites.php
index a5656a73..f224b7d7 100644
--- a/tests/phpunit/includes/site/TestSites.php
+++ b/tests/phpunit/includes/site/TestSites.php
@@ -97,5 +97,4 @@ class TestSites {
$sitesTable->clear();
$sitesTable->saveSites( TestSites::getSites() );
}
-
}