| 1 | <?php |
||
| 9 | class RpcServerTest extends \PHPUnit_Framework_TestCase |
||
| 10 | { |
||
| 11 | public function testSetSerializer() |
||
| 12 | { |
||
| 13 | $options = new RpcServer(); |
||
| 14 | |||
| 15 | $options->setSerializer('PhpSerialize'); |
||
| 16 | static::assertInstanceOf('Zend\\Serializer\\Adapter\\AdapterInterface', $options->getSerializer()); |
||
| 17 | |||
| 18 | $options->setSerializer(null); |
||
| 19 | static::assertNull($options->getSerializer()); |
||
| 20 | |||
| 21 | $options->setSerializer(['name' => 'PhpSerialize']); |
||
| 22 | static::assertInstanceOf('Zend\\Serializer\\Adapter\\AdapterInterface', $options->getSerializer()); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @expectedException \InvalidArgumentException |
||
| 27 | */ |
||
| 28 | public function testSetSerializerWithInvalidValue() |
||
| 29 | { |
||
| 30 | $options = new RpcServer(); |
||
| 31 | |||
| 32 | $options->setSerializer(true); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @expectedException \InvalidArgumentException |
||
| 37 | */ |
||
| 38 | public function testSetSerializerWithEmptyArray() |
||
| 39 | { |
||
| 40 | $options = new RpcServer(); |
||
| 41 | |||
| 42 | $options->setSerializer([]); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |