test: coverage recording now needs to be explicit
[mediawiki.git] / tests / phpunit / includes / TemplateCategoriesTest.php
blobffa8c428b3f1543d88ea2356e08eefe179e34428
1 <?php
3 /**
4 * @group Database
5 */
6 require __DIR__ . "/../../../maintenance/runJobs.php";
8 class TemplateCategoriesTest extends MediaWikiLangTestCase {
10 function testTemplateCategories() {
11 $title = Title::newFromText( "Categorized from template" );
12 $page = WikiPage::factory( $title );
13 $user = new User();
14 $user->mRights = array( 'createpage', 'edit', 'purge' );
16 $page->doEditContent( new WikitextContent( '{{Categorising template}}' ), 'Create a page with a template', 0, false, $user );
17 $this->assertEquals(
18 array()
19 , $title->getParentCategories()
22 $template = WikiPage::factory( Title::newFromText( 'Template:Categorising template' ) );
23 $template->doEditContent( new WikitextContent( '[[Category:Solved bugs]]' ), 'Add a category through a template', 0, false, $user );
25 // Run the job queue
26 JobQueueGroup::destroySingletons();
27 $jobs = new RunJobs;
28 $jobs->loadParamsAndArgs( null, array( 'quiet' => true ), null );
29 $jobs->execute();
31 $this->assertEquals(
32 array( 'Category:Solved_bugs' => $title->getPrefixedText() )
33 , $title->getParentCategories()