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