public function testUsesTitleFromExceptionWhenProvided() { $exception = new Exception\DomainException('exception message', 401); $exception->setTitle('problem title'); $apiProblem = new ApiProblem('401', $exception); $payload = $apiProblem->toArray(); $this->assertArrayHasKey('title', $payload); $this->assertEquals($exception->getTitle(), $payload['title']); }