/** * @dataProvider provideValues */ public function testEscapesStringBeforeHandlingItOverToTheDecoratedLexer(string $value, string $expectedEscapedValue = null) { if (null === $expectedEscapedValue) { $expectedEscapedValue = $value; } $decoratedLexerProphecy = $this->prophesize(LexerInterface::class); $decoratedLexerProphecy->lex($expectedEscapedValue)->willReturn($expected = [new \stdClass()]); /** @var LexerInterface $decoratedLexer */ $decoratedLexer = $decoratedLexerProphecy->reveal(); $lexer = new ReferenceEscaperLexer($decoratedLexer); $actual = $lexer->lex($value); $this->assertEquals($expected, $actual); $decoratedLexerProphecy->lex(Argument::any())->shouldHaveBeenCalledTimes(1); }