3 ), __METHOD__ ); if ( $res === false || strpos( $res, '"sitename":"Wikidata"' ) === false ) { $connectivity = false; } else { $connectivity = true; } } if ( !$connectivity ) { $this->markTestSkipped( 'MediaWikiPageNameNormalizerTest needs internet connectivity.' ); } } /** * @dataProvider normalizePageTitleProvider */ public function testNormalizePageTitle( $expected, $pageName ) { $normalizer = new MediaWikiPageNameNormalizer(); $this->assertSame( $expected, $normalizer->normalizePageName( $pageName, 'https://www.wikidata.org/w/api.php' ) ); } public function normalizePageTitleProvider() { // Note: This makes (very conservative) assumptions about pages on Wikidata // existing or not. return array( 'universe (Q1)' => array( 'Q1', 'Q1' ), 'Q404 redirects to Q395' => array( 'Q395', 'Q404' ), 'there is no Q0' => array( false, 'Q0' ) ); } }