<?php
/**
- *
* @group Database
* ^--- needed for language cache stuff
*/
) );
}
- function testLegalChars() {
+ /**
+ * @covers Title::legalChars
+ */
+ public function testLegalChars() {
$titlechars = Title::legalChars();
foreach ( range( 1, 255 ) as $num ) {
/**
* See also mediawiki.Title.test.js
+ * @covers Title::secureAndSplit
+ * @todo This method should be split into 2 separate tests each with a provider
*/
- function testSecureAndSplit() {
+ public function testSecureAndSplit() {
// Valid
foreach ( array(
'Sandbox',
/**
* @dataProvider provideConvertByteClassToUnicodeClass
+ * @covers Title::convertByteClassToUnicodeClass
*/
- function testConvertByteClassToUnicodeClass( $byteClass, $unicodeClass ) {
+ public function testConvertByteClassToUnicodeClass( $byteClass, $unicodeClass ) {
$this->assertEquals( $unicodeClass, Title::convertByteClassToUnicodeClass( $byteClass ) );
}
/**
* @dataProvider provideBug31100
+ * @covers Title::fixSpecialName
*/
- function testBug31100FixSpecialName( $text, $expectedParam ) {
+ public function testBug31100FixSpecialName( $text, $expectedParam ) {
$title = Title::newFromText( $text );
$fixed = $title->fixSpecialName();
$stuff = explode( '/', $fixed->getDBkey(), 2 );
* @group Database
* @param string $source
* @param string $target
- * @param array|string|true $expected Required error
+ * @param array|string|bool $expected Required error
* @dataProvider provideTestIsValidMoveOperation
+ * @covers Title::isValidMoveOperation
*/
- function testIsValidMoveOperation( $source, $target, $expected ) {
+ public function testIsValidMoveOperation( $source, $target, $expected ) {
$title = Title::newFromText( $source );
$nt = Title::newFromText( $target );
$errors = $title->isValidMoveOperation( $nt, false );
/**
* Provides test parameter values for testIsValidMoveOperation()
*/
- function dataTestIsValidMoveOperation() {
+ public function dataTestIsValidMoveOperation() {
return array(
array( 'Test', 'Test', 'selfmove' ),
array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' )
* @param array $whitelistRegexp
* @param string $source
* @param string $action
- * @param array|string|true $expected Required error
+ * @param array|string|bool $expected Required error
*
* @covers Title::checkReadPermissions
* @dataProvider dataWgWhitelistReadRegexp
*/
- function testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected ) {
+ public function testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected ) {
// $wgWhitelistReadRegexp must be an array. Since the provided test cases
// usually have only one regex, it is more concise to write the lonely regex
// as a string. Thus we cast to an array() to honor $wgWhitelistReadRegexp
/**
* Provides test parameter values for testWgWhitelistReadRegexp()
*/
- function dataWgWhitelistReadRegexp() {
+ public function dataWgWhitelistReadRegexp() {
$ALLOWED = true;
$DISALLOWED = false;
);
}
- function flattenErrorsArray( $errors ) {
+ public function flattenErrorsArray( $errors ) {
$result = array();
foreach ( $errors as $error ) {
$result[] = $error[0];
}
/**
- * @dataProvider provideCasesForGetpageviewlanguage
+ * @dataProvider provideGetPageViewLanguage
+ * @covers Title::getPageViewLanguage
*/
- function testGetpageviewlanguage( $expected, $titleText, $contLang, $lang, $variant, $msg = '' ) {
+ public function testGetPageViewLanguage( $expected, $titleText, $contLang, $lang, $variant, $msg = '' ) {
global $wgLanguageCode, $wgContLang, $wgLang, $wgDefaultLanguageVariant, $wgAllowUserJs;
// Setup environnement for this test
);
}
- public static function provideCasesForGetpageviewlanguage() {
+ public static function provideGetPageViewLanguage() {
# Format:
# - expected
# - Title name
/**
* @dataProvider provideBaseTitleCases
+ * @covers Title::getBaseText
*/
- function testExtractingBaseTextFromTitle( $title, $expected, $msg = '' ) {
+ public function testGetBaseText( $title, $expected, $msg = '' ) {
$title = Title::newFromText( $title );
$this->assertEquals( $expected,
$title->getBaseText(),
/**
* @dataProvider provideRootTitleCases
+ * @covers Title::getRootText
*/
- function testExtractingRootTextFromTitle( $title, $expected, $msg = '' ) {
+ public function testGetRootText( $title, $expected, $msg = '' ) {
$title = Title::newFromText( $title );
$this->assertEquals( $expected,
$title->getRootText(),
/**
* @todo Handle $wgNamespacesWithSubpages cases
* @dataProvider provideSubpageTitleCases
+ * @covers Title::getSubpageText
*/
- function testExtractingSubpageTextFromTitle( $title, $expected, $msg = '' ) {
+ public function testGetSubpageText( $title, $expected, $msg = '' ) {
$title = Title::newFromText( $title );
$this->assertEquals( $expected,
$title->getSubpageText(),