assertEquals('Provided URL http://the_url.com is invalid. Try with a different one.', $e->getMessage()); $this->assertEquals(StatusCodeInterface::STATUS_BAD_REQUEST, $e->getCode()); $this->assertEquals($prev, $e->getPrevious()); } public function providePrevious(): iterable { yield 'null previous' => [null]; yield 'instance previous' => [new Exception('Previous error', 10)]; } }