assertEquals('Provided URL "http://the_url.com" is not an existing and valid URL', $e->getMessage()); $this->assertEquals($prev !== null ? $prev->getCode() : -1, $e->getCode()); $this->assertEquals($prev, $e->getPrevious()); } public function providePrevious(): iterable { yield 'null previous' => [null]; yield 'instance previous' => [new Exception('Previous error', 10)]; } }