Файл: Main Website Files/assets/libraries/stripe-php-2.2.0/tests/RequestOptionsTest.php
Строк: 37
<?php
namespace Stripe;
class RequestOptionsTest extends TestCase
{
public function testStringAPIKey()
{
$opts = UtilRequestOptions::parse("foo");
$this->assertSame("foo", $opts->apiKey);
$this->assertSame(array(), $opts->headers);
}
public function testNull()
{
$opts = UtilRequestOptions::parse(null);
$this->assertSame(null, $opts->apiKey);
$this->assertSame(array(), $opts->headers);
}
public function testEmptyArray()
{
$opts = UtilRequestOptions::parse(array());
$this->assertSame(null, $opts->apiKey);
$this->assertSame(array(), $opts->headers);
}
public function testAPIKeyArray()
{
$opts = UtilRequestOptions::parse(
array(
'api_key' => 'foo',
)
);
$this->assertSame('foo', $opts->apiKey);
$this->assertSame(array(), $opts->headers);
}
public function testIdempotentKeyArray()
{
$opts = UtilRequestOptions::parse(
array(
'idempotency_key' => 'foo',
)
);
$this->assertSame(null, $opts->apiKey);
$this->assertSame(array('Idempotency-Key' => 'foo'), $opts->headers);
}
public function testKeyArray()
{
$opts = UtilRequestOptions::parse(
array(
'idempotency_key' => 'foo',
'api_key' => 'foo'
)
);
$this->assertSame('foo', $opts->apiKey);
$this->assertSame(array('Idempotency-Key' => 'foo'), $opts->headers);
}
/**
* @expectedException StripeErrorApi
*/
public function testWrongType()
{
$opts = UtilRequestOptions::parse(5);
}
}