/** * Test that ValidationException can be created with both a ValidationResult * and a custom message */ public function testCreateWithComplexValidationResultAndMessage() { $result = new ValidationResult(); $result->error('A spork is not a knife')->error('A knife is not a back scratcher'); $exception = new ValidationException($result, 'An error has occurred', E_USER_WARNING); $this->assertEquals(E_USER_WARNING, $exception->getCode()); $this->assertEquals('An error has occurred', $exception->getMessage()); $this->assertEquals(false, $exception->getResult()->valid()); $this->assertEquals('A spork is not a knife; A knife is not a back scratcher', $exception->getResult()->message()); }