forked from yabacon/paystack-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestTest.php
More file actions
41 lines (36 loc) · 1.12 KB
/
RequestTest.php
File metadata and controls
41 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Yabacon\Paystack\Tests\Http;
use Yabacon\Paystack\Http\Request;
use Yabacon\Paystack\Http\Response;
use Yabacon\Paystack;
class RequestTest extends \PHPUnit_Framework_TestCase
{
public function testInitialize()
{
$r = new Request();
$this->assertNotNull($r);
}
public function testAllApiRequestsMustHaveJsonHeader()
{
$p = new Paystack('sk_');
$r = new Request($p);
$this->assertEquals('application/json', $r->headers['Content-Type']);
$rNonApi = new Request();
$this->assertFalse(array_key_exists('Content-Type', $rNonApi->headers));
}
public function testGetResponse()
{
$rq = new Request();
$rp = $rq->getResponse();
$this->assertNotNull($rp);
$this->assertInstanceOf(Response::class, $rp);
}
public function testFlattenedHeadersAndThatOnlyContentTypeAddedByDefaultWhenPaystackObjectPresent()
{
$p = new Paystack('sk_');
$rq = new Request($p);
$hs = $rq->flattenedHeaders();
$this->assertEquals(1, count($hs));
$this->assertNotNull($hs[0]);
}
}