array( 'SpecialAllPages', false ), 'closure' => array( function() { return new SpecialAllPages(); }, false ), 'function' => array( array( $this, 'newSpecialAllPages' ), false ), ); } /** * @covers SpecialPageFactory::getPage * @dataProvider specialPageProvider */ public function testGetPage( $spec, $shouldReuseInstance ) { $this->mergeMwGlobalArrayValue( 'wgSpecialPages', array( 'testdummy' => $spec ) ); SpecialPageFactory::resetList(); $page = SpecialPageFactory::getPage( 'testdummy' ); $this->assertInstanceOf( 'SpecialPage', $page ); $page2 = SpecialPageFactory::getPage( 'testdummy' ); $this->assertEquals( $shouldReuseInstance, $page2 === $page, "Should re-use instance:" ); SpecialPageFactory::resetList(); } /** * @covers SpecialPageFactory::getNames */ public function testGetNames() { $this->mergeMwGlobalArrayValue( 'wgSpecialPages', array( 'testdummy' => 'SpecialAllPages' ) ); SpecialPageFactory::resetList(); $names = SpecialPageFactory::getNames(); $this->assertInternalType( 'array', $names ); $this->assertContains( 'testdummy', $names ); SpecialPageFactory::resetList(); } /** * @covers SpecialPageFactory::resolveAlias */ public function testResolveAlias() { $this->setMwGlobals( 'wgContLang', Language::factory( 'de' ) ); SpecialPageFactory::resetList(); list( $name, $param ) = SpecialPageFactory::resolveAlias( 'Spezialseiten/Foo' ); $this->assertEquals( 'Specialpages', $name ); $this->assertEquals( 'Foo', $param ); SpecialPageFactory::resetList(); } /** * @covers SpecialPageFactory::getLocalNameFor */ public function testGetLocalNameFor() { $this->setMwGlobals( 'wgContLang', Language::factory( 'de' ) ); SpecialPageFactory::resetList(); $name = SpecialPageFactory::getLocalNameFor( 'Specialpages', 'Foo' ); $this->assertEquals( 'Spezialseiten/Foo', $name ); SpecialPageFactory::resetList(); } /** * @covers SpecialPageFactory::getTitleForAlias */ public function testGetTitleForAlias() { $this->setMwGlobals( 'wgContLang', Language::factory( 'de' ) ); SpecialPageFactory::resetList(); $title = SpecialPageFactory::getTitleForAlias( 'Specialpages/Foo' ); $this->assertEquals( 'Spezialseiten/Foo', $title->getText() ); $this->assertEquals( NS_SPECIAL, $title->getNamespace() ); SpecialPageFactory::resetList(); } }