assertEquals( true, $title->isNamespaceIdKnown() ); $this->assertEquals( $expectedId, $title->getNamespaceId() ); $this->assertEquals( $expectedName, $title->getNamespaceName() ); $this->assertEquals( $expectedText, $title->getText() ); } public function testUnknownNamespaceCheck( ) { $title = new ForeignTitle( null, 'this', 'that' ); $this->assertEquals( false, $title->isNamespaceIdKnown() ); $this->assertEquals( 'this', $title->getNamespaceName() ); $this->assertEquals( 'that', $title->getText() ); } public function testUnknownNamespaceError( ) { $this->setExpectedException( 'MWException' ); $title = new ForeignTitle( null, 'this', 'that' ); $title->getNamespaceId(); } public function fullTextProvider() { return array( array( new ForeignTitle( 20, 'Contributor', 'JohnDoe' ), 'Contributor:JohnDoe' ), array( new ForeignTitle( '1', 'Discussion', 'Capital' ), 'Discussion:Capital' ), array( new ForeignTitle( 0, '', 'MainNamespace' ), 'MainNamespace' ), array( new ForeignTitle( 4, 'Some ns', 'Article title with spaces' ), 'Some_ns:Article_title_with_spaces' ), ); } /** * @dataProvider fullTextProvider */ public function testFullText( ForeignTitle $title, $fullText ) { $this->assertEquals( $fullText, $title->getFullText() ); } }