Pmiazga has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/365689 )
Change subject: SkinMinerva testGetContextSpecificModule test might use undefined title ...................................................................... SkinMinerva testGetContextSpecificModule test might use undefined title Test scenario for getContextSpecificModules() mocks only Skin->getTitle() behavior, but while executing isAllowedPageAction() Skin will create a UserPageHelper with default RequestContext. As RequestContext is not mocked, $context->getTitle() will return undefined what could lead to tests crash Changes: - instead of mocking SkinMinerva::getTitle() pass test context with injected title. Other tests will work properly as MediaWikiTestCase::tearDown() always restes RequestContext to default Bug: T170624 Change-Id: I872fddf8d9c52a6875bb6c69a12407a8125fba4c --- M tests/phpunit/skins/SkinMinervaTest.php 1 file changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue refs/changes/89/365689/1 diff --git a/tests/phpunit/skins/SkinMinervaTest.php b/tests/phpunit/skins/SkinMinervaTest.php index 7970ed6..abebdd2 100644 --- a/tests/phpunit/skins/SkinMinervaTest.php +++ b/tests/phpunit/skins/SkinMinervaTest.php @@ -177,15 +177,16 @@ ->getMock() ); $title = Title::newFromText( 'Test' ); - $skin->expects( $this->any() ) - ->method( 'getTitle' ) - ->will( $this->returnValue( $title ) ); + $testContext = RequestContext::getMain(); + $testContext->setTitle( $title ); + $skin->setContext ( $testContext ); $skin->setSkinOptions( [ 'fontChanger' => $fontchangerValue, 'backToTop' => $backToTopValue, ] ); + if ( $expected ) { $this->assertContains( $moduleName, $skin->getContextSpecificModules() ); } else { -- To view, visit https://gerrit.wikimedia.org/r/365689 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I872fddf8d9c52a6875bb6c69a12407a8125fba4c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/MinervaNeue Gerrit-Branch: master Gerrit-Owner: Pmiazga <pmia...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits