From d417de70fcf39e0a7a15ba780b597914d16ca0f7 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 12 Mar 2014 18:12:23 +0100 Subject: Update to MediaWiki 1.22.4 --- tests/phpunit/includes/site/SiteListTest.php | 197 --------------------------- 1 file changed, 197 deletions(-) delete mode 100644 tests/phpunit/includes/site/SiteListTest.php (limited to 'tests/phpunit/includes/site/SiteListTest.php') diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php deleted file mode 100644 index 8af2fc1b..00000000 --- a/tests/phpunit/includes/site/SiteListTest.php +++ /dev/null @@ -1,197 +0,0 @@ - - */ -class SiteListTest extends MediaWikiTestCase { - - /** - * Returns instances of SiteList implementing objects. - * @return array - */ - public function siteListProvider() { - $sitesArrays = $this->siteArrayProvider(); - - $listInstances = array(); - - foreach ( $sitesArrays as $sitesArray ) { - $listInstances[] = new SiteList( $sitesArray[0] ); - } - - return $this->arrayWrap( $listInstances ); - } - - /** - * Returns arrays with instances of Site implementing objects. - * @return array - */ - public function siteArrayProvider() { - $sites = TestSites::getSites(); - - $siteArrays = array(); - - $siteArrays[] = $sites; - - $siteArrays[] = array( array_shift( $sites ) ); - - $siteArrays[] = array( array_shift( $sites ), array_shift( $sites ) ); - - return $this->arrayWrap( $siteArrays ); - } - - /** - * @dataProvider siteListProvider - * @param SiteList $sites - * @covers SiteList::isEmpty - */ - public function testIsEmpty( SiteList $sites ) { - $this->assertEquals( count( $sites ) === 0, $sites->isEmpty() ); - } - - /** - * @dataProvider siteListProvider - * @param SiteList $sites - * @covers SiteList::getSite - */ - public function testGetSiteByGlobalId( SiteList $sites ) { - if ( $sites->isEmpty() ) { - $this->assertTrue( true ); - } else { - /** - * @var Site $site - */ - foreach ( $sites as $site ) { - $this->assertEquals( $site, $sites->getSite( $site->getGlobalId() ) ); - } - } - } - - /** - * @dataProvider siteListProvider - * @param SiteList $sites - * @covers SiteList::getSiteByInternalId - */ - public function testGetSiteByInternalId( $sites ) { - /** - * @var Site $site - */ - foreach ( $sites as $site ) { - if ( is_integer( $site->getInternalId() ) ) { - $this->assertEquals( $site, $sites->getSiteByInternalId( $site->getInternalId() ) ); - } - } - - $this->assertTrue( true ); - } - - /** - * @dataProvider siteListProvider - * @param SiteList $sites - * @covers SiteList::hasSite - */ - public function testHasGlobalId( $sites ) { - $this->assertFalse( $sites->hasSite( 'non-existing-global-id' ) ); - $this->assertFalse( $sites->hasInternalId( 720101010 ) ); - - if ( !$sites->isEmpty() ) { - /** - * @var Site $site - */ - foreach ( $sites as $site ) { - $this->assertTrue( $sites->hasSite( $site->getGlobalId() ) ); - } - } - } - - /** - * @dataProvider siteListProvider - * @param SiteList $sites - * @covers SiteList::hasInternalId - */ - public function testHasInternallId( $sites ) { - /** - * @var Site $site - */ - foreach ( $sites as $site ) { - if ( is_integer( $site->getInternalId() ) ) { - $this->assertTrue( $site, $sites->hasInternalId( $site->getInternalId() ) ); - } - } - - $this->assertFalse( $sites->hasInternalId( -1 ) ); - } - - /** - * @dataProvider siteListProvider - * @param SiteList $sites - * @covers SiteList::getGlobalIdentifiers - */ - public function testGetGlobalIdentifiers( SiteList $sites ) { - $identifiers = $sites->getGlobalIdentifiers(); - - $this->assertTrue( is_array( $identifiers ) ); - - $expected = array(); - - /** - * @var Site $site - */ - foreach ( $sites as $site ) { - $expected[] = $site->getGlobalId(); - } - - $this->assertArrayEquals( $expected, $identifiers ); - } - - /** - * @dataProvider siteListProvider - * - * @since 1.21 - * - * @param SiteList $list - * @covers SiteList::getSerializationData - * @covers SiteList::unserialize - */ - public function testSerialization( SiteList $list ) { - $serialization = serialize( $list ); - /** - * @var SiteArray $copy - */ - $copy = unserialize( $serialization ); - - $this->assertArrayEquals( $list->getGlobalIdentifiers(), $copy->getGlobalIdentifiers() ); - - /** - * @var Site $site - */ - foreach ( $list as $site ) { - $this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) ); - } - } -} -- cgit v1.2.2