deprecated. There are no known callers.
* File::getStreamHeaders() was deprecated.
* MediaHandler::getStreamHeaders() was deprecated.
+* Title::canTalk() was deprecated, the new Title::canHaveTalkPage() should be
+ used instead.
+* MWNamespace::canTalk() was deprecated, the new MWNamespace::hasTalkNamespace()
+ should be used instead.
* The ExtractThumbParameters hook (deprecated in 1.21) was removed.
* The OutputPage::addParserOutputNoText and ::getHeadLinks methods (both
deprecated in 1.24) were removed.
}
/**
- * Can this namespace ever have a talk namespace?
+ * Does this namespace ever have a talk namespace?
+ *
+ * @deprecated since 1.30, use hasTalkNamespace() instead.
*
* @param int $index Namespace index
- * @return bool
+ * @return bool True if this namespace either is or has a corresponding talk namespace.
*/
public static function canTalk( $index ) {
+ return self::hasTalkNamespace( $index );
+ }
+
+ /**
+ * Does this namespace ever have a talk namespace?
+ *
+ * @since 1.30
+ *
+ * @param int $index Namespace ID
+ * @return bool True if this namespace either is or has a corresponding talk namespace.
+ */
+ public static function hasTalkNamespace( $index ) {
return $index >= NS_MAIN;
}
}
/**
- * Could this title have a corresponding talk page?
+ * Can this title have a corresponding talk page?
*
- * @return bool
+ * @deprecated since 1.30, use canHaveTalkPage() instead.
+ *
+ * @return bool True if this title either is a talk page or can have a talk page associated.
*/
public function canTalk() {
- return MWNamespace::canTalk( $this->mNamespace );
+ return $this->canHaveTalkPage();
+ }
+
+ /**
+ * Can this title have a corresponding talk page?
+ *
+ * @see MWNamespace::hasTalkNamespace
+ *
+ * @return bool True if this title either is a talk page or can have a talk page associated.
+ */
+ public function canHaveTalkPage() {
+ return MWNamespace::hasTalkNamespace( $this->mNamespace );
}
/**
}
*/
+ public function provideHasTalkNamespace() {
+ return [
+ [ NS_MEDIA, false ],
+ [ NS_SPECIAL, false ],
+
+ [ NS_MAIN, true ],
+ [ NS_TALK, true ],
+ [ NS_USER, true ],
+ [ NS_USER_TALK, true ],
+
+ [ 100, true ],
+ [ 101, true ],
+ ];
+ }
+
/**
- * @covers MWNamespace::canTalk
+ * @dataProvider provideHasTalkNamespace
+ * @covers MWNamespace::hasTalkNamespace
+ *
+ * @param int $index
+ * @param bool $expected
*/
- public function testCanTalk() {
- $this->assertCanNotTalk( NS_MEDIA );
- $this->assertCanNotTalk( NS_SPECIAL );
-
- $this->assertCanTalk( NS_MAIN );
- $this->assertCanTalk( NS_TALK );
- $this->assertCanTalk( NS_USER );
- $this->assertCanTalk( NS_USER_TALK );
+ public function testHasTalkNamespace( $index, $expected ) {
+ $actual = MWNamespace::hasTalkNamespace( $index );
+ $this->assertSame( $actual, $expected, "NS $index" );
+ }
- // User defined namespaces
- $this->assertCanTalk( 100 );
- $this->assertCanTalk( 101 );
+ /**
+ * @dataProvider provideHasTalkNamespace
+ * @covers MWNamespace::canTalk
+ *
+ * @param int $index
+ * @param bool $expected
+ */
+ public function testCanTalk( $index, $expected ) {
+ $actual = MWNamespace::canTalk( $index );
+ $this->assertSame( $actual, $expected, "NS $index" );
}
/**
);
}
+ public function provideCanHaveTalkPage() {
+ return [
+ 'User page has talk page' => [
+ Title::makeTitle( NS_USER, 'Jane' ), true
+ ],
+ 'Talke page has talk page' => [
+ Title::makeTitle( NS_TALK, 'Foo' ), true
+ ],
+ 'Special page cannot have talk page' => [
+ Title::makeTitle( NS_SPECIAL, 'Thing' ), false
+ ],
+ 'Virtual namespace cannot have talk page' => [
+ Title::makeTitle( NS_MEDIA, 'Kitten.jpg' ), false
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider provideCanHaveTalkPage
+ * @covers Title::canHaveTalkPage
+ *
+ * @param Title $title
+ * @param bool $expected
+ */
+ public function testCanHaveTalkPage( Title $title, $expected ) {
+ $actual = $title->canHaveTalkPage();
+ $this->assertSame( $expected, $actual, $title->getPrefixedDBkey() );
+ }
+
+ /**
+ * @dataProvider provideCanHaveTalkPage
+ * @covers Title::canTalk
+ *
+ * @param Title $title
+ * @param bool $expected
+ */
+ public function testCanTalk( Title $title, $expected ) {
+ $actual = $title->canTalk();
+ $this->assertSame( $expected, $actual, $title->getPrefixedDBkey() );
+ }
+
public function provideCreateFragmentTitle() {
return [
[ Title::makeTitle( NS_MAIN, 'Test' ), 'foo' ],