Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
676 lars 1
<?php
2
 
3
namespace Srmklive\PayPal\Tests\Unit\Client;
4
 
5
use GuzzleHttp\Utils;
6
use PHPUnit\Framework\TestCase;
7
use Srmklive\PayPal\Tests\MockClientClasses;
8
use Srmklive\PayPal\Tests\MockRequestPayloads;
9
use Srmklive\PayPal\Tests\MockResponsePayloads;
10
 
11
class InvoicesSearchTest extends TestCase
12
{
13
    use MockClientClasses;
14
    use MockRequestPayloads;
15
    use MockResponsePayloads;
16
 
17
    /** @test */
18
    public function it_can_search_invoices()
19
    {
20
        $expectedResponse = $this->mockSearchInvoicesResponse();
21
 
22
        $expectedEndpoint = 'https://api-m.sandbox.paypal.com/v2/invoicing/search-invoices?page=1&page_size=1&total_required=true';
23
        $expectedParams = [
24
            'headers' => [
25
                'Accept'            => 'application/json',
26
                'Accept-Language'   => 'en_US',
27
                'Authorization'     => 'Bearer some-token',
28
            ],
29
            'json' => $this->invoiceSearchParams(),
30
        ];
31
 
32
        $mockHttpClient = $this->mock_http_request(Utils::jsonEncode($expectedResponse), $expectedEndpoint, $expectedParams, 'post');
33
 
34
        $this->assertEquals($expectedResponse, Utils::jsonDecode($mockHttpClient->post($expectedEndpoint, $expectedParams)->getBody(), true));
35
    }
36
}