/** * @expectedException Exception */ public function testLoadNotReadableException() { $storage = new FilesystemStorage(); vfsStream::newFile('public.key', 0600)->at($this->root)->setContent('C:16:"Bitpay\\PublicKey":62:{a:5:{i:0;s:20:"vfs://tmp/public.key";i:1;N;i:2;N;i:3;N;i:4;N;}}')->chown(vfsStream::OWNER_ROOT)->chgrp(vfsStream::GROUP_ROOT); $storage->load(vfsStream::url('tmp/public.key')); }
public function confirmBitPayInvoice($bitPayInvoice) { $storageEngine = new Bitpay\Storage\FilesystemStorage(); if (_BIT_PAY_PRODUCTION_) { $privateKey = $storageEngine->load('/tmp/bitpay.pri'); $publicKey = $storageEngine->load('/tmp/bitpay.pub'); } else { $privateKey = $storageEngine->load('/tmp/bitpaydev.pri'); $publicKey = $storageEngine->load('/tmp/bitpaydev.pub'); } $client = new Bitpay\Client\Client(); if (_BIT_PAY_PRODUCTION_) { $network = new Bitpay\Network\Livenet(); } else { $network = new Bitpay\Network\Testnet(); } $adapter = new Bitpay\Client\Adapter\CurlAdapter(); $client->setPrivateKey($privateKey); $client->setPublicKey($publicKey); $client->setNetwork($network); $client->setAdapter($adapter); $token = new Bitpay\Token(); if (_BIT_PAY_PRODUCTION_) { $token->setToken(_BIT_PAY_TOKEN_LIVE_NET_); } else { $token->setToken(_BIT_PAY_TOKEN_TEST_NET_); } $client->setToken($token); $invoice = $client->getInvoice($bitPayInvoice); return $invoice->getStatus(); }
/** * @expectedException Exception */ public function testLoadNotReadableException() { $storage = new FilesystemStorage(); vfsStream::newFile('public.key', 0600)->at($this->root)->setContent($this->key_file_content)->chown(vfsStream::OWNER_ROOT)->chgrp(vfsStream::GROUP_ROOT); $storage->load(vfsStream::url('tmp/public.key')); }