| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/Dolibarr/htdocs/includes/stripe/tests/ |
Upload File : |
<?php
namespace Stripe;
class ErrorTest extends TestCase
{
public function testCreation()
{
try {
throw new Error\Api(
"hello",
500,
"{'foo':'bar'}",
array('foo' => 'bar')
);
$this->fail("Did not raise error");
} catch (Error\Api $e) {
$this->assertSame("hello", $e->getMessage());
$this->assertSame(500, $e->getHttpStatus());
$this->assertSame("{'foo':'bar'}", $e->getHttpBody());
$this->assertSame(array('foo' => 'bar'), $e->getJsonBody());
$this->assertSame(null, $e->getHttpHeaders());
$this->assertSame(null, $e->getRequestId());
}
}
public function testResponseHeaders()
{
try {
throw new Error\Api(
"hello",
500,
"{'foo':'bar'}",
array('foo' => 'bar'),
array('Request-Id' => 'req_bar')
);
$this->fail("Did not raise error");
} catch (Error\Api $e) {
$this->assertSame(array('Request-Id' => 'req_bar'), $e->getHttpHeaders());
$this->assertSame('req_bar', $e->getRequestId());
}
}
public function testCode()
{
try {
throw new Error\Card(
"hello",
"some_param",
"some_code",
400,
"{'foo':'bar'}",
array('foo' => 'bar')
);
$this->fail("Did not raise error");
} catch (Error\Card $e) {
$this->assertSame("some_param", $e->getStripeParam());
$this->assertSame('some_code', $e->getStripeCode());
}
}
}