'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(), $prev); self::assertEquals($invalidData, $e->getInvalidElements()); self::assertEquals(['invalidElements' => array_keys($invalidData)], $e->getAdditionalData()); self::assertEquals('Provided data is not valid', $e->getMessage()); self::assertEquals(StatusCodeInterface::STATUS_BAD_REQUEST, $e->getCode()); self::assertEquals($prev, $e->getPrevious()); self::assertStringContainsString($expectedStringRepresentation, (string) $e); $getMessages->shouldHaveBeenCalledOnce(); } public function provideExceptions(): iterable { return [[null], [new RuntimeException()], [new LogicException()]]; } }