| 676 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Srmklive\PayPal\Tests\Unit\Adapter;
|
|
|
4 |
|
|
|
5 |
use PHPUnit\Framework\TestCase;
|
|
|
6 |
use Srmklive\PayPal\Tests\MockClientClasses;
|
|
|
7 |
use Srmklive\PayPal\Tests\MockRequestPayloads;
|
|
|
8 |
use Srmklive\PayPal\Tests\MockResponsePayloads;
|
|
|
9 |
|
|
|
10 |
class InvoicesTemplatesTest extends TestCase
|
|
|
11 |
{
|
|
|
12 |
use MockClientClasses;
|
|
|
13 |
use MockRequestPayloads;
|
|
|
14 |
use MockResponsePayloads;
|
|
|
15 |
|
|
|
16 |
/** @test */
|
|
|
17 |
public function it_can_create_invoice_template()
|
|
|
18 |
{
|
|
|
19 |
$expectedResponse = $this->mockCreateInvoiceTemplateResponse();
|
|
|
20 |
|
|
|
21 |
$expectedParams = $this->mockCreateInvoiceTemplateParams();
|
|
|
22 |
|
|
|
23 |
$expectedMethod = 'createInvoiceTemplate';
|
|
|
24 |
|
|
|
25 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
26 |
|
|
|
27 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
28 |
$mockClient->getAccessToken();
|
|
|
29 |
|
|
|
30 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}($expectedParams));
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
/** @test */
|
|
|
34 |
public function it_can_list_invoice_templates()
|
|
|
35 |
{
|
|
|
36 |
$expectedResponse = $this->mockListInvoiceTemplateResponse();
|
|
|
37 |
|
|
|
38 |
$expectedMethod = 'listInvoiceTemplates';
|
|
|
39 |
|
|
|
40 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
41 |
|
|
|
42 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
43 |
$mockClient->getAccessToken();
|
|
|
44 |
|
|
|
45 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}());
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
/** @test */
|
|
|
49 |
public function it_can_delete_an_invoice_template()
|
|
|
50 |
{
|
|
|
51 |
$expectedResponse = '';
|
|
|
52 |
|
|
|
53 |
$expectedMethod = 'deleteInvoiceTemplate';
|
|
|
54 |
|
|
|
55 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
56 |
|
|
|
57 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
58 |
$mockClient->getAccessToken();
|
|
|
59 |
|
|
|
60 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('TEMP-19V05281TU309413B'));
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/** @test */
|
|
|
64 |
public function it_can_update_an_invoice_template()
|
|
|
65 |
{
|
|
|
66 |
$expectedResponse = $this->mockUpdateInvoiceTemplateResponse();
|
|
|
67 |
|
|
|
68 |
$expectedParams = $this->mockUpdateInvoiceTemplateParams();
|
|
|
69 |
|
|
|
70 |
$expectedMethod = 'updateInvoiceTemplate';
|
|
|
71 |
|
|
|
72 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
73 |
|
|
|
74 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
75 |
$mockClient->getAccessToken();
|
|
|
76 |
|
|
|
77 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('TEMP-19V05281TU309413B', $expectedParams));
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
/** @test */
|
|
|
81 |
public function it_can_get_details_for_an_invoice_template()
|
|
|
82 |
{
|
|
|
83 |
$expectedResponse = $this->mockGetInvoiceTemplateResponse();
|
|
|
84 |
|
|
|
85 |
$expectedMethod = 'showInvoiceTemplateDetails';
|
|
|
86 |
|
|
|
87 |
$mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
|
|
|
88 |
|
|
|
89 |
$mockClient->setApiCredentials($this->getMockCredentials());
|
|
|
90 |
$mockClient->getAccessToken();
|
|
|
91 |
|
|
|
92 |
$this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}('TEMP-19V05281TU309413B'));
|
|
|
93 |
}
|
|
|
94 |
}
|