diff --git a/.travis.yml b/.travis.yml index dd396a334..64df4c112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ php: env: global: - - STRIPE_MOCK_VERSION=0.24.1 + - STRIPE_MOCK_VERSION=0.25.0 matrix: - AUTOLOAD=1 - AUTOLOAD=0 diff --git a/init.php b/init.php index 8222aa55b..822cb6399 100644 --- a/init.php +++ b/init.php @@ -75,6 +75,7 @@ require(dirname(__FILE__) . '/lib/EphemeralKey.php'); require(dirname(__FILE__) . '/lib/Event.php'); require(dirname(__FILE__) . '/lib/ExchangeRate.php'); +require(dirname(__FILE__) . '/lib/FileLink.php'); require(dirname(__FILE__) . '/lib/FileUpload.php'); require(dirname(__FILE__) . '/lib/Invoice.php'); require(dirname(__FILE__) . '/lib/InvoiceItem.php'); diff --git a/lib/FileLink.php b/lib/FileLink.php new file mode 100644 index 000000000..6650e40af --- /dev/null +++ b/lib/FileLink.php @@ -0,0 +1,30 @@ + 'Stripe\\Event', \Stripe\ExchangeRate::OBJECT_NAME => 'Stripe\\ExchangeRate', \Stripe\ApplicationFeeRefund::OBJECT_NAME => 'Stripe\\ApplicationFeeRefund', + \Stripe\FileLink::OBJECT_NAME => 'Stripe\\FileLink', \Stripe\FileUpload::OBJECT_NAME => 'Stripe\\FileUpload', \Stripe\Invoice::OBJECT_NAME => 'Stripe\\Invoice', \Stripe\InvoiceItem::OBJECT_NAME => 'Stripe\\InvoiceItem', diff --git a/tests/Stripe/FileLinkTest.php b/tests/Stripe/FileLinkTest.php new file mode 100644 index 000000000..9ff89e40d --- /dev/null +++ b/tests/Stripe/FileLinkTest.php @@ -0,0 +1,65 @@ +expectsRequest( + 'get', + '/v1/file_links' + ); + $resources = FileLink::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\FileLink", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/file_links/' . self::TEST_RESOURCE_ID + ); + $resource = FileLink::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\FileLink", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/file_links' + ); + $resource = FileLink::create([ + "file" => "file_123" + ]); + $this->assertInstanceOf("Stripe\\FileLink", $resource); + } + + public function testIsSaveable() + { + $resource = FileLink::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/file_links/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\FileLink", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/file_links/' . self::TEST_RESOURCE_ID + ); + $resource = FileLink::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\FileLink", $resource); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 871876452..8a0754428 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,6 @@