From: Max Semenik Date: Thu, 17 Jul 2014 22:28:46 +0000 (-0700) Subject: Editing unit tests: set title in context X-Git-Tag: 1.31.0-rc.0~14900 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22lang_raccourcis%22%2C%22module=%24nom_module%22%29%20.%20%22?a=commitdiff_plain;h=bfa5d12e11af9a8fc30f04e541c28d11e62c3a18;p=lhc%2Fweb%2Fwiklou.git Editing unit tests: set title in context It is assumed that users of EditFilterMergedContent hook need to get the page being edited from context as it happens during normal functioning, tests shouldn't violate this convention. Bug: 66930 Change-Id: I8d453d819aad8630d4934a15e7bf512fa828fe24 --- diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php index 3c653b4a7a..6b8bf2720f 100644 --- a/tests/phpunit/includes/EditPageTest.php +++ b/tests/phpunit/includes/EditPageTest.php @@ -96,6 +96,7 @@ class EditPageTest extends MediaWikiLangTestCase { $ns = $this->getDefaultWikitextNS(); $title = Title::newFromText( $title, $ns ); } + $this->assertNotNull( $title ); if ( is_string( $user ) ) { $user = User::newFromName( $user ); @@ -141,7 +142,9 @@ class EditPageTest extends MediaWikiLangTestCase { $req = new FauxRequest( $edit, true ); // session ?? - $ep = new EditPage( new Article( $title ) ); + $article = new Article( $title ); + $article->getContext()->setTitle( $title ); + $ep = new EditPage( $article ); $ep->setContextTitle( $title ); $ep->importFormData( $req );