-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathRequestTest.php
64 lines (47 loc) · 1.47 KB
/
RequestTest.php
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
64
<?php
namespace Razorpay\Tests;
use Razorpay\Api\Request;
class RequestTest extends TestCase
{
public function setUp(): void
{
parent::setUp();
}
/**
* Create customer
*/
public function testaddHeader()
{
$data = $this->api->customer->create(array('name' => 'Razorpay User 38', 'email' => 'customer38@razorpay.com' ,'fail_existing'=>'0'));
$this->assertTrue(is_array($data->toArray()));
$this->assertTrue(in_array('customer',$data->toArray()));
}
/**
* Edit customer
*/
public function testEditCustomer()
{
$data = $this->api->customer->fetch($this->customerId)->edit(array('name' => 'Razorpay User 21' ,'contact'=>'9123456780'));
$this->assertTrue(is_array($data->toArray()));
$this->assertTrue(in_array($this->customerId, $data->toArray()));
}
/**
* Fetch customer All
*/
public function testFetchAll()
{
$data = $this->api->customer->all();
$this->assertTrue(is_array($data->toArray()));
$this->assertTrue(is_numeric($data->count()));
$this->assertTrue(is_array($data['items']));
}
/**
* Fetch a customer
*/
public function testFetchCustomer()
{
$data = $this->api->customer->fetch($this->customerId);
$this->assertTrue(is_array($data->toArray()));
$this->assertTrue(in_array($this->customerId, $data->toArray()));
}
}