Merge "Accessibility: Make the collapsible sidebar screen reader friendly"
[lhc/web/wiklou.git] / tests / phpunit / includes / TemplateCategoriesTest.php
1 <?php
2
3 /**
4 * @group Database
5 */
6 require __DIR__ . "/../../../maintenance/runJobs.php";
7
8 class TemplateCategoriesTest extends MediaWikiLangTestCase {
9
10 /**
11 * @covers Title::getParentCategories
12 */
13 public function testTemplateCategories() {
14 $title = Title::newFromText( "Categorized from template" );
15 $page = WikiPage::factory( $title );
16 $user = new User();
17 $user->mRights = array( 'createpage', 'edit', 'purge' );
18
19 $page->doEditContent(
20 new WikitextContent( '{{Categorising template}}' ),
21 'Create a page with a template',
22 0,
23 false,
24 $user
25 );
26
27 $this->assertEquals(
28 array()
29 , $title->getParentCategories()
30 );
31
32 $template = WikiPage::factory( Title::newFromText( 'Template:Categorising template' ) );
33
34 $template->doEditContent(
35 new WikitextContent( '[[Category:Solved bugs]]' ),
36 'Add a category through a template',
37 0,
38 false,
39 $user
40 );
41
42 // Run the job queue
43 JobQueueGroup::destroySingletons();
44 $jobs = new RunJobs;
45 $jobs->loadParamsAndArgs( null, array( 'quiet' => true ), null );
46 $jobs->execute();
47
48 $this->assertEquals(
49 array( 'Category:Solved_bugs' => $title->getPrefixedText() )
50 , $title->getParentCategories()
51 );
52 }
53 }