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\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 InvoicesSearchTest extends TestCase
11
{
12
    use MockClientClasses;
13
    use MockRequestPayloads;
14
    use MockResponsePayloads;
15
 
16
    /** @test */
17
    public function it_can_search_invoices()
18
    {
19
        $expectedResponse = $this->mockSearchInvoicesResponse();
20
 
21
        $expectedMethod = 'searchInvoices';
22
 
23
        $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
24
 
25
        $mockClient->setApiCredentials($this->getMockCredentials());
26
        $mockClient->getAccessToken();
27
 
28
        $this->assertEquals($expectedResponse, $mockClient->{$expectedMethod}(1, 1, true));
29
    }
30
 
31
    /** @test */
32
    public function it_can_search_invoices_with_custom_filters()
33
    {
34
        $expectedResponse = $this->mockSearchInvoicesResponse();
35
 
36
        $expectedMethod = 'searchInvoices';
37
 
38
        $mockClient = $this->mock_client($expectedResponse, $expectedMethod, true);
39
 
40
        $mockClient->setApiCredentials($this->getMockCredentials());
41
        $mockClient->getAccessToken();
42
 
43
        $this->assertEquals($expectedResponse, $mockClient->addInvoiceFilterByRecipientEmail('bill-me@example.com')
44
            ->addInvoiceFilterByCurrencyCode('USD')
45
            ->addInvoiceFilterByAmountRange(30, 50)
46
            ->{$expectedMethod}(1, 1, true));
47
    }
48
}