[ 'vector', null, false, '"1" isn\'t considered latest.' ]; yield 'met' => [ 'vector-2022', null, true, '"2" is considered latest.' ]; yield 'met (useskin override)' => [ 'vector', 'vector-2022', true, 'useskin overrides' ]; yield 'not met (useskin override)' => [ 'vector-2022', 'vector', false, 'useskin overrides' ]; } /** * @dataProvider provideIsMet * @covers ::isMet */ public function testIsMet( $skin, $useSkin, $expected, $msg ) { $user = $this->createMock( User::class ); $user->method( 'isRegistered' )->willReturn( true ); $user->method( 'isSafeToLoad' )->willReturn( true ); $userOptionsLookup = $this->createMock( UserOptionsLookup::class ); $userOptionsLookup->method( 'getOption' ) ->willReturn( $skin ); $request = $this->createMock( WebRequest::class ); $request->method( 'getVal' ) ->willReturn( $useSkin ); $requirement = new LatestSkinVersionRequirement( $request, $user, $userOptionsLookup ); $this->assertSame( $expected, $requirement->isMet(), $msg ); } }