Page MenuHomePhabricator

UserGroupMembershipTest::testGetLink failing on travis
Closed, ResolvedPublic

Description

https://travis-ci.org/wikimedia/mediawiki/jobs/617106595

1) UserGroupMembershipTest::testGetLink
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache: using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[wfDebug] [debug] User: loading options for user 2 from database. {"private":false}
[wfDebug] [debug] User: loading options for user 3 from database. {"private":false}
[localisation] [debug] LocalisationCache: using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"}
[wfDebug] [debug] IP: 127.0.0.1 {"private":false}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
[wfDebug] [debug] ParserFactory: using preprocessor: Preprocessor_Hash {"private":false}
===
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'<a href="/index.php?title=Project:Administrators&amp;action=edit&amp;redlink=1" class="new" title="Project:Administrators (page does not exist)">Administrators</a>'
+'<a href="/w/index.php?title=Project:Administrators&amp;action=edit&amp;redlink=1" class="new" title="Project:Administrators (page does not exist)">Administrators</a>'
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/user/UserGroupMembershipTest.php:200
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiIntegrationTestCase.php:416
/home/travis/build/wikimedia/mediawiki/maintenance/doMaintenance.php:99

Details

Related Gerrit Patches:

Event Timeline

Reedy created this task.Nov 26 2019, 10:16 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 26 2019, 10:16 AM
DannyS712 added a subscriber: DannyS712.EditedNov 26 2019, 10:18 AM

That test was one of a few just added in T234921: Factor group membership management out of User class - is it the only one that is failing?

That test was one of a few just added in T234921: Factor group membership management out of User class - is it the only one that is failing?

Looking at https://github.com/wikimedia/mediawiki/blob/6f6829f/tests/phpunit/includes/user/UserGroupMembershipTest.php I would suspect another of the tests in that function will fail... But I guess the test bails out once one failure is reached?

		$this->assertSame(
			'<a href="/index.php?title=Project:Administrators&amp;action=edit&amp;' .
			'redlink=1" class="new" title="Project:Administrators (page does not exist)">' .
			'Administrators</a>',
			UserGroupMembership::getLink( $ugm, $context, 'html' )
		);

and

		$this->assertSame(
			'<a href="/index.php?title=Project:Administrators&amp;action=edit&amp;' .
			'redlink=1" class="new" title="Project:Administrators (page does not exist)">' .
			'administrator</a>',
			UserGroupMembership::getLink( $ugm, $context, 'html', $user->getName() )
		);

Purely due to the hardcoding of /index.php rather than using $wgScriptPath and/or $wgScript

Certainly, manually constructed HTML looks an icky way to test, and definitely likely to break in future

Change 553072 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Unbreak UserGroupMembershipTest::testGetLink

https://gerrit.wikimedia.org/r/553072

As a temporary measure I tweaked the tests to expect /w/index.php rather than just /index.php

Restricted Application added a project: User-DannyS712. · View Herald TranscriptNov 26 2019, 11:13 AM

Change 553072 merged by jenkins-bot:
[mediawiki/core@master] Unbreak UserGroupMembershipTest::testGetLink

https://gerrit.wikimedia.org/r/553072

Reedy closed this task as Resolved.Nov 26 2019, 11:44 AM
Reedy removed a project: Patch-For-Review.

Thanks!

DannyS712 moved this task from Unsorted to Merged on the User-DannyS712 board.Nov 26 2019, 11:54 AM