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