# 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
75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* @license Copyright 2011-2015 BitPay Inc., MIT License
|
|
* see https://github.com/bitpay/php-bitpay-client/blob/master/LICENSE
|
|
*/
|
|
|
|
namespace Bitpay\Config;
|
|
|
|
use Symfony\Component\Config\Definition\Processor;
|
|
|
|
class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testProcessAndValidate()
|
|
{
|
|
$processor = new Processor();
|
|
$processedConfig = $processor->processConfiguration(
|
|
new Configuration(),
|
|
array()
|
|
);
|
|
|
|
$this->assertArrayHasKey('public_key', $processedConfig);
|
|
$this->assertArrayHasKey('private_key', $processedConfig);
|
|
$this->assertArrayHasKey('sin_key', $processedConfig);
|
|
$this->assertArrayHasKey('adapter', $processedConfig);
|
|
$this->assertArrayHasKey('key_storage', $processedConfig);
|
|
$this->assertArrayHasKey('key_storage_password', $processedConfig);
|
|
$this->assertCount(6, $processedConfig);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Exception
|
|
*/
|
|
public function testClassNotFoundKeyStorageConfig()
|
|
{
|
|
$processor = new Processor();
|
|
$processor->processConfiguration(
|
|
new Configuration(),
|
|
array(
|
|
'bitpay' => array(
|
|
'key_storage' => 'Foo\Bar'
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Exception
|
|
*/
|
|
public function testClassDoesNotImplementInterfaceKeyStorageConfig()
|
|
{
|
|
$processor = new Processor();
|
|
$processor->processConfiguration(
|
|
new Configuration(),
|
|
array(
|
|
'bitpay' => array(
|
|
'key_storage' => 'stdClass'
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
public function testAcceptableKeyStorageConfig()
|
|
{
|
|
$processor = new Processor();
|
|
$processor->processConfiguration(
|
|
new Configuration(),
|
|
array(
|
|
'bitpay' => array(
|
|
'key_storage' => '\\Bitpay\\Storage\\EncryptedFilesystemStorage'
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|