From bfa5d12e11af9a8fc30f04e541c28d11e62c3a18 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Thu, 17 Jul 2014 15:28:46 -0700 Subject: [PATCH] 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 --- tests/phpunit/includes/EditPageTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 ); -- 2.20.1