# Conflicts: # .travis.yml # README.md # VERSION # composer.json # src/Bitpay/Client/Client.php # src/Bitpay/Client/ClientInterface.php # src/Bitpay/Client/Request.php # src/Bitpay/Client/Response.php # src/Bitpay/Config/Configuration.php # src/Bitpay/Currency.php # src/Bitpay/DependencyInjection/services.xml # src/Bitpay/Invoice.php # src/Bitpay/InvoiceInterface.php # src/Bitpay/Item.php # src/Bitpay/Network/Testnet.php # src/Bitpay/PrivateKey.php # src/Bitpay/Storage/EncryptedFilesystemStorage.php # src/Bitpay/Util/Util.php # tests/Bitpay/BitpayTest.php # tests/Bitpay/Client/Adapter/CurlAdapterTest.php # tests/Bitpay/Client/ClientTest.php # tests/Bitpay/Client/RequestTest.php # tests/Bitpay/Crypto/McryptExtensionTest.php # tests/Bitpay/ItemTest.php # tests/Bitpay/Math/BcEngineTest.php # tests/Bitpay/Network/LivenetTest.php # tests/Bitpay/Network/NetworkAwareTest.php # tests/Bitpay/Network/TestnetTest.php # tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php # tests/DataFixtures/invoices/5NxFkXcJbCSivtQRJa4kHP.json
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* @license Copyright 2011-2015 BitPay Inc., MIT License
|
|
* see https://github.com/bitpay/php-bitpay-client/blob/master/LICENSE
|
|
*/
|
|
|
|
namespace Bitpay\Client\Adapter;
|
|
|
|
use Bitpay\Client\Request;
|
|
|
|
class CurlAdapterTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $request;
|
|
|
|
public function setUp()
|
|
{
|
|
$this->request = new Request();
|
|
}
|
|
|
|
public function testConstruct()
|
|
{
|
|
$adapter = new CurlAdapter();
|
|
$this->assertNotNull($adapter->getCurlOptions());
|
|
}
|
|
|
|
public function testGetCurlOptions()
|
|
{
|
|
$adapter = new CurlAdapter();
|
|
$this->assertEquals(array(), $adapter->getCurlOptions());
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Bitpay\Client\ConnectionException
|
|
*/
|
|
public function testSendRequestWithException()
|
|
{
|
|
$curl_options = array(
|
|
CURLOPT_URL => 'btcpay.example.com',
|
|
CURLOPT_SSL_VERIFYPEER => 1,
|
|
CURLOPT_SSL_VERIFYHOST => 2,
|
|
);
|
|
|
|
$adapter = new CurlAdapter($curl_options);
|
|
$adapter->sendRequest($this->request);
|
|
}
|
|
|
|
public function testSendRequestWithoutException()
|
|
{
|
|
$curl_options = array(
|
|
CURLOPT_URL => 'www.bitpay.com',
|
|
CURLOPT_SSL_VERIFYPEER => 1,
|
|
CURLOPT_SSL_VERIFYHOST => 2,
|
|
);
|
|
|
|
$adapter = new CurlAdapter($curl_options);
|
|
$response = $adapter->sendRequest($this->request);
|
|
$this->assertNotNull($response);
|
|
}
|
|
}
|