use __call() to instantly have some new fresh helpers
[lhc/web/wiklou.git] / tests / phpunit / includes / TemplateCategoriesTest.php
1 <?php
2
3 /**
4 * @group Database
5 */
6 require dirname( __FILE__ ) . "/../../../maintenance/runJobs.php";
7
8 class TemplateCategoriesTest extends MediaWikiLangTestCase {
9
10 function testTemplateCategories() {
11 global $wgUser;
12
13 $title = Title::newFromText( "Categorized from template" );
14 $article = new Article( $title );
15 $wgUser = new User();
16 $wgUser->mRights['*'] = array( 'createpage', 'edit', 'purge' );
17
18 $status = $article->doEdit( '{{Categorising template}}', 'Create a page with a template', 0 );
19 $this->assertEquals( $title->getParentCategories(), array() );
20
21 $template = new Article( Title::newFromText( 'Template:Categorising template' ) );
22 $status = $template->doEdit( '[[Category:Solved bugs]]', 'Add a category through a template', 0 );
23
24 // Run the job queue
25 $jobs = new RunJobs;
26 $jobs->loadParamsAndArgs( null, array( 'quiet' => true ), null );
27 $jobs->execute();
28
29 $this->assertEquals( $title->getParentCategories(), array( 'Category:Solved_bugs' => $title->getPrefixedText() ) );
30 }
31
32 }