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(): array { return [ [null], [new Exception('Previos error', 10)], ]; } }