Skip to content

Commit

Permalink
Fix create files test (#24)
Browse files Browse the repository at this point in the history
* Ignore clover file

* Start working on file creation test

* Remove dotenv

* Update create file test
  • Loading branch information
levidurfee committed Nov 17, 2018
1 parent 9437dd6 commit cf896ec
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ $RECYCLE.BIN/
index.php

.php_cs.cache
clover.xml
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"bulldog/id": "^1.0"
},
"require-dev": {
"vlucas/phpdotenv": "^2.5",
"phpunit/phpunit": "^7.4",
"symfony/var-dumper": "^4.1",
"php-coveralls/php-coveralls": "^2.1"
Expand Down
3 changes: 3 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
<testsuite name="Model">
<file>tests/ModelTest.php</file>
</testsuite>
<testsuite name="FileCreation">
<file>tests/FileCreationTest.php</file>
</testsuite>
</testsuites>
<filter>
<whitelist>
Expand Down
42 changes: 1 addition & 41 deletions tests/FileCreationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,9 @@

class FileCreationTest extends TestCase
{
/**
* @before
*/
public function setUpUploadBase()
{
\Stripe\Stripe::$apiUploadBase = \Stripe\Stripe::$apiBase;
\Stripe\Stripe::$apiBase = null;
}

/**
* @after
*/
public function tearDownUploadBase()
{
\Stripe\Stripe::$apiBase = \Stripe\Stripe::$apiUploadBase;
\Stripe\Stripe::$apiUploadBase = 'https://files.stripe.com';
}

public function testIsCreatableWithFileHandle()
{
\Stripe\Stripe::setApiKey(getenv('STRIPE_API_KEY'));
$this->expectsRequest(
'post',
'/v1/files',
Expand All @@ -40,27 +23,4 @@ public function testIsCreatableWithFileHandle()
$resource = $this->strype->file()->create($logo)->getResponse();
$this->assertInstanceOf("Stripe\\File", $resource);
}

// public function testIsCreatableWithCurlFile()
// {
// if (!class_exists('\CurlFile', false)) {
// // Older PHP versions don't support this
// return;
// }

// $this->expectsRequest(
// 'post',
// '/v1/files',
// null,
// ['Content-Type: multipart/form-data'],
// true,
// \Stripe\Stripe::$apiUploadBase
// );
// $curlFile = new \CurlFile(dirname(__FILE__) . '/../data/test.png');
// $resource = File::create([
// "purpose" => "dispute_evidence",
// "file" => $curlFile,
// ]);
// $this->assertInstanceOf("Stripe\\File", $resource);
// }
}

0 comments on commit cf896ec

Please sign in to comment.