Bitpay\BitpayTest::testConfigAbleToPersistAndLoadKeys PHP Method

testConfigAbleToPersistAndLoadKeys() public method

    public function testConfigAbleToPersistAndLoadKeys()
    {
        $root = vfsStream::setup('tmp');
        $bitpay = new \Bitpay\Bitpay(array('bitpay' => array('network' => 'testnet', 'private_key' => vfsStream::url('tmp/key.pri'), 'public_key' => vfsStream::url('tmp/key.pub'))));
        $pri = new \Bitpay\PrivateKey(vfsStream::url('tmp/key.pri'));
        $pri->generate();
        $pub = new \Bitpay\PublicKey(vfsStream::url('tmp/key.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');
    }