8 protected function setUp() {
17 'wgContLang' => Language::factory(
'en' ),
18 'wgLanguageCode' =>
'en',
19 'wgCapitalLinks' =>
true,
38 $title = Title::newFromText(
"text" );
39 $this->assertInstanceOf( Title::class, $title,
"Title creation" );
40 $this->assertEquals(
"Text", $title,
"Automatic string conversion" );
42 $title = Title::newFromText(
"text",
NS_MEDIA );
43 $this->assertEquals(
"Media:Text", $title,
"Title creation with namespace" );
53 [
'Text',
null,
'Text' ],
54 [
'text',
null,
'Text' ],
55 [
'Text',
NS_USER,
'User:Text' ],
56 [
'Photo.jpg',
NS_FILE,
'File:Photo.jpg' ]
67 $title = Title::newFromText( $titleName, $ns );
68 $this->assertEquals( $text,
"$title",
"see if '$titleName' matches '$text'" );
72 $title = Title::newMainPage();
73 $this->assertEquals(
"Main Page",
"$title",
"Test initial creation of a title" );
95 $this->assertTrue( $title->isLocal() );
103 $title = Title::newFromText( Title::newFromText(
"test" ) );
104 $this->assertEquals(
"Test", $title->isLocal() );
tearDown()
Anything cleanup you need to do should go here.
testTitleObjectStringConversion()
Name tests so that PHPUnit can turn them into sentences when they run.
testTitleObjectFromObject()
InvalidArgumentException See https://phpunit.de/manual/3.7/en/appendixes.annotations....
setUp()
Anything that needs to happen before your tests should go here.
testCheckMainPageTitleIsConsideredLocal( $title)
Instead of putting a bunch of tests in a single test method, you should put only one or two tests in ...
testSetUpMainPageTitleForNextTest()
static provideTitles()
If you want to run a the same test with a variety of data, use a data provider.
testCreateBasicListOfTitles( $titleName, $ns, $text)
phpcs:disable Generic.Files.LineLength provideTitles See https://phpunit.de/manual/3....
namespace and then decline to actually register it file or subcat img or subcat $title