public function testConstructsCorrectlyWithDescription() { $exception = new InvalidRequestException(422, 'there was an error'); $this->assertEquals(422, $exception->getHttpStatusCode()); $this->assertEquals('there was an error', $exception->getDescription()); $this->assertEquals('PHP_GCM\\InvalidRequestException: HTTP Status Code: 422 (there was an error)', (string) $exception); }
public function testConstruct() { $exception = new InvalidRequestException('Oops'); $this->assertSame('Oops', $exception->getMessage()); }
/** * Creates a new MalformedResponseException instance. * * @param string $message * The exception message. * @param \Exception|null $previous * The previous exception. * @param int $code * The exception code. * @param \Psr\Http\Message\ResponseInterface|null $response * The response. */ public function __construct($message = "", \Exception $previous = null, $code = 0, ResponseInterface $response = null) { parent::__construct($message, $code, $previous); $this->response = $response; }
public function __construct() { parent::__construct('域名后缀不在管局允许的列表中'); }
public function testGetCode() { $exception = new InvalidRequestException(); $this->assertSame(-32600, $exception->getCode()); }