testClass = new class extends RedisCommand { use Newline; public static $newlineArgumentPositionOffset = 0; public function getId() { return 'test'; } }; } /** * @dataProvider argumentsProvider * @param int $offset * @param array $actualArguments * @param array $expectedResponse * @return void */ public function testReturnsCorrectArguments( int $offset, array $actualArguments, array $expectedResponse ): void { $this->testClass::$newlineArgumentPositionOffset = $offset; $this->testClass->setArguments($actualArguments); $this->assertSame($expectedResponse, $this->testClass->getArguments()); } /** * @return void */ public function testThrowsExceptionOnUnexpectedValueGiven(): void { $this->expectException(UnexpectedValueException::class); $this->expectExceptionMessage('Newline argument value should be a string'); $this->testClass->setArguments([1]); } public function argumentsProvider(): array { return [ 'with wrong offset' => [ 2, ['argument1'], ['argument1'], ], 'with default value' => [ 0, [''], [false], ], 'with correct argument' => [ 0, ['\n'], ['NEWLINE', '\n'], ], ]; } }