And implementation for TitleValue, plus tests
Change-Id: I42c301e28938dcd55580e20b7c1ddefcbf5a2bef
*/
public function getNamespace();
+ /**
+ * Convenience function to test if it is in the namespace
+ *
+ * @param int $ns
+ * @return bool
+ */
+ public function inNamespace( $ns );
+
/**
* Get the link fragment (i.e. the bit after the #) in text form.
*
return $this->namespace;
}
+ /**
+ * @since 1.27
+ * @param int $ns
+ * @return bool
+ */
+ public function inNamespace( $ns ) {
+ return $this->namespace == $ns;
+ }
+
/**
* @return string
*/
$title = new TitleValue( $ns, $text, $fragment, $interwiki );
$this->assertEquals( $ns, $title->getNamespace() );
+ $this->assertTrue( $title->inNamespace( $ns ) );
$this->assertEquals( $text, $title->getText() );
$this->assertEquals( $fragment, $title->getFragment() );
$this->assertEquals( $hasFragment, $title->hasFragment() );