forked from yabacon/paystack-php
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPaystackTest.php
More file actions
63 lines (54 loc) · 1.68 KB
/
PaystackTest.php
File metadata and controls
63 lines (54 loc) · 1.68 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Yabacon\Paystack\Tests;
use Yabacon\Paystack;
use Yabacon\Paystack\Helpers\Router;
use \Yabacon\Paystack\Exception\ValidationException;
class PaystackTest extends \PHPUnit_Framework_TestCase
{
public function testInitializeWithInvalidSecretKey()
{
$this->expectException(\InvalidArgumentException::class);
$r = new Paystack('p');
}
public function testVersion()
{
$this->assertEquals("2.1.11", Paystack::VERSION);
}
public function testSetUseGuzzle()
{
$r = new Paystack('sk_');
$r->useGuzzle();
$this->assertTrue($r->use_guzzle);
}
public function testGetShouldBringRouter()
{
$r = new Paystack('sk_');
$this->assertInstanceOf(Router::class, $r->customer);
$this->expectException(ValidationException::class);
$this->assertNull($r->nonexistent);
}
public function testListInvalidResource()
{
$r = new Paystack('sk_');
$this->expectException(\InvalidArgumentException::class);
$this->assertNull($r->nonexistents());
}
public function testFetchInvalidResource()
{
$r = new Paystack('sk_');
$this->expectException(ValidationException::class);
$this->assertNull($r->nonexistent(1));
}
public function testFetchWithInvalidParams2()
{
$r = new Paystack('sk_');
$this->expectException(\InvalidArgumentException::class);
$this->assertNull($r->customer());
}
public function testFetchWithInvalidParams3()
{
$r = new Paystack('sk_');
$this->expectException(\InvalidArgumentException::class);
$this->assertNull($r->customers(1));
}
}