wiki.techinc.nl/tests/phpunit/includes/TemplateCategoriesTest.php
jeroendedauw 38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00

36 lines
1 KiB
PHP

<?php
/**
* @group Database
*/
require __DIR__ . "/../../../maintenance/runJobs.php";
class TemplateCategoriesTest extends MediaWikiLangTestCase {
function testTemplateCategories() {
$title = Title::newFromText( "Categorized from template" );
$page = WikiPage::factory( $title );
$user = new User();
$user->mRights = array( 'createpage', 'edit', 'purge' );
$status = $page->doEdit( '{{Categorising template}}', 'Create a page with a template', 0, false, $user );
$this->assertEquals(
array()
, $title->getParentCategories()
);
$template = WikiPage::factory( Title::newFromText( 'Template:Categorising template' ) );
$status = $template->doEdit( '[[Category:Solved bugs]]', 'Add a category through a template', 0, false, $user );
// Run the job queue
$jobs = new RunJobs;
$jobs->loadParamsAndArgs( null, array( 'quiet' => true ), null );
$jobs->execute();
$this->assertEquals(
array( 'Category:Solved_bugs' => $title->getPrefixedText() )
, $title->getParentCategories()
);
}
}