mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
PreferencesIntegrationTest: CA will fail on null
User objects
`$this->createMock( User::class )` will return a mock User object with all fields defaulting to null and this will fail when the `onGetPreferences()` hook fires in CA since that gets consumed by `getFormDescriptor()` in PreferencesFactory. This patch changes the mock user object to a test user object and this is fine because it's already an integration test. Bug: T357854 Change-Id: I3d80fc1e59ff00a1a08def41c53d82bc093b6e00
This commit is contained in:
parent
ada6d85fe6
commit
bc193d41a7
|
@ -3,7 +3,6 @@
|
|||
namespace MediaWiki\Extension\Math\Tests;
|
||||
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\User\User;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
use RequestContext;
|
||||
|
||||
|
@ -26,7 +25,7 @@ class PreferencesIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
$context->setTitle( Title::makeTitle( NS_MAIN, 'Dummy' ) );
|
||||
$allPreferences = $this->getServiceContainer()
|
||||
->getPreferencesFactory()
|
||||
->getFormDescriptor( $this->createMock( User::class ), $context );
|
||||
->getFormDescriptor( $this->getTestUser()->getUser(), $context );
|
||||
$this->assertArrayHasKey( 'math', $allPreferences );
|
||||
$mathPrefs = $allPreferences['math'];
|
||||
$this->assertSame( 'radio', $mathPrefs['type'] );
|
||||
|
|
Loading…
Reference in a new issue