|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Sake |
| 4 | + * |
| 5 | + * @link http://github.com/sandrokeil/BlockchainWalletApi for the canonical source repository |
| 6 | + * @copyright Copyright (c) 2014 Sandro Keil |
| 7 | + * @license http://github.com/sandrokeil/BlockchainWalletApi/blob/master/LICENSE.txt New BSD License |
| 8 | + */ |
| 9 | + |
| 10 | +namespace SakeTest\BlockchainWalletApi\Service; |
| 11 | + |
| 12 | +use Sake\BlockchainWalletApi\Service\BlockchainWalletOptions; |
| 13 | +use PHPUnit_Framework_TestCase as TestCase; |
| 14 | + |
| 15 | +/** |
| 16 | + * Class BlockChainWalletTest |
| 17 | + * |
| 18 | + * Tests integrity of \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions |
| 19 | + */ |
| 20 | +class BlockchainWalletOptionsTest extends TestCase |
| 21 | +{ |
| 22 | + /** |
| 23 | + * Tests setGuid() and getGuid() should work as expected |
| 24 | + * |
| 25 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::setGuid |
| 26 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getGuid |
| 27 | + * @group service |
| 28 | + */ |
| 29 | + public function testSetGuid() |
| 30 | + { |
| 31 | + $cut = new BlockchainWalletOptions(); |
| 32 | + $value = '123123123'; |
| 33 | + |
| 34 | + $cut->setGuid($value); |
| 35 | + |
| 36 | + $this->assertEquals($value, $cut->getGuid()); |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * Tests setHttpMethod() and getHttpMethod() should work as expected |
| 41 | + * |
| 42 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::setHttpMethod |
| 43 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getHttpMethod |
| 44 | + * @group service |
| 45 | + */ |
| 46 | + public function testSetHttpMethod() |
| 47 | + { |
| 48 | + $cut = new BlockchainWalletOptions(); |
| 49 | + $value = \Zend\Http\Request::METHOD_POST; |
| 50 | + |
| 51 | + $this->assertEquals(\Zend\Http\Request::METHOD_GET, $cut->getHttpMethod()); |
| 52 | + |
| 53 | + $cut->setHttpMethod($value); |
| 54 | + |
| 55 | + $this->assertEquals($value, $cut->getHttpMethod()); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Tests setMainPassword() and getMainPassword() should work as expected |
| 60 | + * |
| 61 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::setMainPassword |
| 62 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getMainPassword |
| 63 | + * @group service |
| 64 | + */ |
| 65 | + public function testSetMainPassword() |
| 66 | + { |
| 67 | + $cut = new BlockchainWalletOptions(); |
| 68 | + $value = 'secure'; |
| 69 | + |
| 70 | + $cut->setMainPassword($value); |
| 71 | + |
| 72 | + $this->assertEquals($value, $cut->getMainPassword()); |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Tests setSecondPassword() and getSecondPassword() should work as expected |
| 77 | + * |
| 78 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::setSecondPassword |
| 79 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getSecondPassword |
| 80 | + * @group service |
| 81 | + */ |
| 82 | + public function testSetSecondPassword() |
| 83 | + { |
| 84 | + $cut = new BlockchainWalletOptions(); |
| 85 | + $value = 'secure second'; |
| 86 | + |
| 87 | + $cut->setSecondPassword($value); |
| 88 | + |
| 89 | + $this->assertEquals($value, $cut->getSecondPassword()); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * Tests setUrl() and getUrl() should work as expected |
| 94 | + * |
| 95 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::setUrl |
| 96 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getUrl |
| 97 | + * @group service |
| 98 | + */ |
| 99 | + public function testSetUrl() |
| 100 | + { |
| 101 | + $cut = new BlockchainWalletOptions(); |
| 102 | + $value = 'https://blockchain.info/de/merchant/'; |
| 103 | + |
| 104 | + $cut->setUrl($value); |
| 105 | + |
| 106 | + $this->assertEquals($value, $cut->getUrl()); |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Tests getResponsePluginManager() return default response plugin manager if no one provided |
| 111 | + * |
| 112 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getResponsePluginManager |
| 113 | + * @group service |
| 114 | + */ |
| 115 | + public function testGetResponsePluginManagerShouldReturnDefaultResponsePluginManager() |
| 116 | + { |
| 117 | + $cut = new BlockchainWalletOptions(); |
| 118 | + |
| 119 | + $this->assertInstanceOf( |
| 120 | + '\Sake\BlockchainWalletApi\Service\ResponsePluginManager', |
| 121 | + $cut->getResponsePluginManager() |
| 122 | + ); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Tests getInputFilterPluginManager() return default input filter manager if no one provided |
| 127 | + * |
| 128 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getInputFilterPluginManager |
| 129 | + * @group service |
| 130 | + */ |
| 131 | + public function testGetInputFilterPluginManagerShouldReturnDefaultFilterPluginManager() |
| 132 | + { |
| 133 | + $cut = new BlockchainWalletOptions(); |
| 134 | + |
| 135 | + $this->assertInstanceOf( |
| 136 | + '\Sake\BlockchainWalletApi\Service\InputFilterPluginManager', |
| 137 | + $cut->getInputFilterPluginManager() |
| 138 | + ); |
| 139 | + } |
| 140 | + |
| 141 | + /** |
| 142 | + * Tests getHydrator() return class methods hydrator if no one provided |
| 143 | + * |
| 144 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::getHydrator |
| 145 | + * @group service |
| 146 | + */ |
| 147 | + public function testGetHydratorShouldReturnDefaultClassMethods() |
| 148 | + { |
| 149 | + $cut = new BlockchainWalletOptions(); |
| 150 | + |
| 151 | + $this->assertInstanceOf( |
| 152 | + '\Zend\Stdlib\Hydrator\ClassMethods', |
| 153 | + $cut->getHydrator() |
| 154 | + ); |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * Tests setHydrator() |
| 159 | + * |
| 160 | + * @covers \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions::setHydrator |
| 161 | + * @group service |
| 162 | + */ |
| 163 | + public function testsetHydrator() |
| 164 | + { |
| 165 | + $cut = new BlockchainWalletOptions(); |
| 166 | + |
| 167 | + $cut->setHydrator(new \Zend\Stdlib\Hydrator\ObjectProperty()); |
| 168 | + |
| 169 | + $this->assertInstanceOf( |
| 170 | + '\Zend\Stdlib\Hydrator\ObjectProperty', |
| 171 | + $cut->getHydrator() |
| 172 | + ); |
| 173 | + } |
| 174 | +} |
0 commit comments