assertEquals('Provided IP "1.2.3.4" is invalid', $e->getMessage()); $this->assertEquals(0, $e->getCode()); $this->assertNull($e->getPrevious()); } /** @test */ public function fromIpAddressProperlyCreatesExceptionWithPrev() { $prev = new Exception('Previous error'); $e = WrongIpException::fromIpAddress('1.2.3.4', $prev); $this->assertEquals('Provided IP "1.2.3.4" is invalid', $e->getMessage()); $this->assertEquals(0, $e->getCode()); $this->assertSame($prev, $e->getPrevious()); } }