Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
991 lars 1
<?php
2
 
3
namespace Srmklive\PayPal\Tests\Feature;
4
 
5
use PHPUnit\Framework\TestCase;
6
use Srmklive\PayPal\Services\PayPal as PayPalClient;
7
use Srmklive\PayPal\Tests\MockClientClasses;
8
use Srmklive\PayPal\Tests\MockResponsePayloads;
9
 
10
class AdapterBillingPlansPricingHelpersTest extends TestCase
11
{
12
    use MockClientClasses;
13
    use MockResponsePayloads;
14
 
15
    /** @var string */
16
    protected static $access_token = '';
17
 
18
    /** @var \Srmklive\PayPal\Services\PayPal */
19
    protected $client;
20
 
21
    protected function setUp(): void
22
    {
23
        $this->client = new PayPalClient($this->getApiCredentials());
24
 
25
        $this->client->setClient(
26
            $this->mock_http_client(
27
                $this->mockAccessTokenResponse()
28
            )
29
        );
30
        $response = $this->client->getAccessToken();
31
 
32
        self::$access_token = $response['access_token'];
33
 
34
        parent::setUp();
35
    }
36
 
37
    /** @test */
38
    public function it_can_update_pricing_schemes_for_a_billing_plan()
39
    {
40
        $this->client->setAccessToken([
41
            'access_token'  => self::$access_token,
42
            'token_type'    => 'Bearer',
43
        ]);
44
 
45
        $this->client = $this->client->addBillingPlanById('P-5ML4271244454362WXNWU5NQ')
46
            ->addPricingScheme('DAY', 7, 0, true)
47
            ->addPricingScheme('MONTH', 1, 100);
48
 
49
        $this->client->setClient(
50
            $this->mock_http_client(false)
51
        );
52
 
53
        $response = $this->client->processBillingPlanPricingUpdates();
54
 
55
        $this->assertEmpty($response);
56
    }
57
}