createMock( User::class ); $title = $isTitlePresent ? $this->createMock( Title::class ) : null; $request = new FauxRequest(); $userOptionsLookup = $this->createMock( UserOptionsLookup::class ); $userOptionsLookup->method( 'getOption' )->willReturn( $isEnabled ); $requirement = new UserPreferenceRequirement( $user, $userOptionsLookup, 'userOption', 'userRequirement', $request, $title ); $this->assertSame( $expected, $requirement->isMet(), $msg ); } }