[MediaWiki-commits] [Gerrit] Clear up cached Main_page title in test - change (mediawiki...Echo)
Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/150191 Change subject: Clear up cached Main_page title in test .. Clear up cached Main_page title in test In Echo tests/NotificationFormatterTest.php there is a test that ends up invoking the Linker to create full URL for Main_page and pass it a fragment. Title::newMainPage() is really Title::newFromText('Main_Page') which is cached. Whenever the fragment is set, it stuck in the cache entry and later call to Title::newMainPage() yields a Title object which has the fragment. That cause Scribunto tests (at least) to fail when Echo tests are run before it because Scribunto tests expect a Main_Page title without a fragment. The ugly workaround is to have the Echo test to reset the fragment. We could clear up the Title cache between tests though. Bug: 68646 Change-Id: I625492fc8bf0dbd6e10275c3a728f5c1f85768c8 --- M tests/NotificationFormatterTest.php 1 file changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo refs/changes/91/150191/1 diff --git a/tests/NotificationFormatterTest.php b/tests/NotificationFormatterTest.php index 60f3b26..20349f2 100644 --- a/tests/NotificationFormatterTest.php +++ b/tests/NotificationFormatterTest.php @@ -34,6 +34,14 @@ } else { $this->assertRegExp( $pattern, $formatted['body'] ); } + + # Reset the Title cache + $mainPage = Title::newMainPage(); + $mainPage->setFragment(''); + # And assert it has been cleaned up + $mainPageCached = Title::newMainPage(); + $this->assertEquals( '', $mainPageCached->getFragment() ); + } public static function provider_editUserTalk() { -- To view, visit https://gerrit.wikimedia.org/r/150191 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I625492fc8bf0dbd6e10275c3a728f5c1f85768c8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Hashar ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Clear up cached Main_page title in test - change (mediawiki...Echo)
jenkins-bot has submitted this change and it was merged. Change subject: Clear up cached Main_page title in test .. Clear up cached Main_page title in test In Echo tests/NotificationFormatterTest.php there is a test that ends up invoking the Linker to create full URL for Main_page and pass it a fragment. Title::newMainPage() is really Title::newFromText('Main_Page') which is cached. Whenever the fragment is set, it stuck in the cache entry and later call to Title::newMainPage() yields a Title object which has the fragment. That cause Scribunto tests (at least) to fail when Echo tests are run before it because Scribunto tests expect a Main_Page title without a fragment. The ugly workaround is to have the Echo test to reset the fragment. We could clear up the Title cache between tests though. Bug: 68646 Change-Id: I625492fc8bf0dbd6e10275c3a728f5c1f85768c8 --- M tests/NotificationFormatterTest.php 1 file changed, 8 insertions(+), 0 deletions(-) Approvals: BryanDavis: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/NotificationFormatterTest.php b/tests/NotificationFormatterTest.php index 60f3b26..20349f2 100644 --- a/tests/NotificationFormatterTest.php +++ b/tests/NotificationFormatterTest.php @@ -34,6 +34,14 @@ } else { $this->assertRegExp( $pattern, $formatted['body'] ); } + + # Reset the Title cache + $mainPage = Title::newMainPage(); + $mainPage->setFragment(''); + # And assert it has been cleaned up + $mainPageCached = Title::newMainPage(); + $this->assertEquals( '', $mainPageCached->getFragment() ); + } public static function provider_editUserTalk() { -- To view, visit https://gerrit.wikimedia.org/r/150191 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I625492fc8bf0dbd6e10275c3a728f5c1f85768c8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Hashar Gerrit-Reviewer: Anomie Gerrit-Reviewer: BryanDavis Gerrit-Reviewer: Hashar Gerrit-Reviewer: Legoktm Gerrit-Reviewer: Ori.livneh Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits