temp_path_root = 'tmp'; $this->temp_path_pri = $this->temp_path_root . '/key.pri'; $this->temp_path_pub = $this->temp_path_root . '/key.pub'; } public function testConstruct() { $bitpay = new \Bitpay\Bitpay( array( 'bitpay' => array() ) ); } public function testGetContainer() { $bitpay = new \Bitpay\Bitpay(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $bitpay->getContainer()); } public function testGet() { $bitpay = new \Bitpay\Bitpay(); $this->assertInstanceOf('Bitpay\Client\Adapter\CurlAdapter', $bitpay->get('adapter')); } /** * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException */ public function testGetInvalidService() { $bitpay = new \Bitpay\Bitpay(); $bitpay->get('coins'); } public function testConfigAbleToPersistAndLoadKeys() { $root = vfsStream::setup($this->temp_path_root); $bitpay = new \Bitpay\Bitpay( array( 'bitpay' => array( 'private_key' => vfsStream::url($this->temp_path_pri), 'public_key' => vfsStream::url($this->temp_path_pub), ) ) ); $pri = new \Bitpay\PrivateKey(vfsStream::url($this->temp_path_pri)); $pri->generate(); $pub = new \Bitpay\PublicKey(vfsStream::url($this->temp_path_pub)); $pub->setPrivateKey($pri)->generate(); /** * Save keys to the filesystem */ $storage = $bitpay->get('key_storage'); $storage->persist($pri); $storage->persist($pub); /** * This will load the keys, if you have not already persisted them, than * this WILL throw an Exception since this will load the keys from the * storage class */ $pri = $bitpay->get('private_key'); $pub = $bitpay->get('public_key'); } }