'bar', 'something' => ['baz', 'foo'], ]; $barValue = print_r(['baz', 'foo'], true); $expectedStringRepresentation = << bar 'something' => {$barValue} EOT; $inputFilter = $this->prophesize(InputFilterInterface::class); $getMessages = $inputFilter->getMessages()->willReturn($invalidData); $e = ValidationException::fromInputFilter($inputFilter->reveal()); $this->assertEquals($invalidData, $e->getInvalidElements()); $this->assertEquals('Provided data is not valid', $e->getMessage()); $this->assertEquals(StatusCodeInterface::STATUS_BAD_REQUEST, $e->getCode()); $this->assertEquals($prev, $e->getPrevious()); $this->assertStringContainsString($expectedStringRepresentation, (string) $e); $getMessages->shouldHaveBeenCalledOnce(); } public function provideExceptions(): iterable { return [[null, new RuntimeException(), new LogicException()]]; } }