%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/eirtvhdf/logobrainiac.com/root_stripe/stripe/tests/Stripe/
Upload File :
Create Path :
Current File : /home/eirtvhdf/logobrainiac.com/root_stripe/stripe/tests/Stripe/AlipayAccountTest.php

<?php

namespace Stripe;

class AlipayAccountTest extends TestCase
{
    const TEST_RESOURCE_ID = 'aliacc_123';

    // Because of the wildcard nature of sources, stripe-mock cannot currently
    // reliably return sources of a given type, so we create a fixture manually
    public function createFixture($params = [])
    {
        if (empty($params)) {
            $params['customer'] = 'cus_123';
        }
        $base = [
            'id' => self::TEST_RESOURCE_ID,
            'object' => 'card',
            'metadata' => [],
        ];
        return AlipayAccount::constructFrom(
            array_merge($params, $base),
            new Util\RequestOptions()
        );
    }

    public function testHasCorrectUrlForCustomer()
    {
        $resource = $this->createFixture(['customer' => 'cus_123']);
        $this->assertSame(
            "/v1/customers/cus_123/sources/" . self::TEST_RESOURCE_ID,
            $resource->instanceUrl()
        );
    }

    /**
     * @expectedException \Stripe\Error\InvalidRequest
     */
    public function testIsNotDirectlyRetrievable()
    {
        AlipayAccount::retrieve(self::TEST_RESOURCE_ID);
    }

    public function testIsSaveable()
    {
        $resource = $this->createFixture();
        $resource->metadata["key"] = "value";
        $this->expectsRequest(
            'post',
            '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID
        );
        $resource->save();
        $this->assertSame("Stripe\\AlipayAccount", get_class($resource));
    }

    /**
     * @expectedException \Stripe\Error\InvalidRequest
     */
    public function testIsNotDirectlyUpdatable()
    {
        AlipayAccount::update(self::TEST_RESOURCE_ID, [
            "metadata" => ["key" => "value"],
        ]);
    }

    public function testIsDeletable()
    {
        $resource = $this->createFixture();
        $this->expectsRequest(
            'delete',
            '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID
        );
        $resource->delete();
        $this->assertSame("Stripe\\AlipayAccount", get_class($resource));
    }
}

Zerion Mini Shell 1.0