| Conditions | 1 |
| Paths | 1 |
| Total Lines | 39 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | public function testSetProperties() |
||
| 9 | { |
||
| 10 | $expected = new Request; |
||
| 11 | $actual = clone $expected; |
||
| 12 | |||
| 13 | // 1st |
||
| 14 | $expected->jsonrpc = '2.0'; |
||
| 15 | $expected->method = 'withoutParams'; |
||
| 16 | $expected->params = ['s' => 'sss']; |
||
| 17 | $expected->id = 1; |
||
| 18 | |||
| 19 | $actual->setProperties([ |
||
| 20 | 'jsonrpc' => '2.0', |
||
| 21 | 'method' => 'withoutParams', |
||
| 22 | 'params' => ['s' => 'sss'], |
||
| 23 | 'id' => 1, |
||
| 24 | ]); |
||
| 25 | $this->assertEquals($expected, $actual); |
||
| 26 | |||
| 27 | // 2nd |
||
| 28 | $expected->method = 'withoutParams'; |
||
| 29 | |||
| 30 | $actual = clone $expected; |
||
| 31 | $actual->setProperties([ |
||
| 32 | 'method' => 'withoutParams', |
||
| 33 | 'not_exists_1' => 2, |
||
| 34 | ]); |
||
| 35 | $this->assertEquals($expected, $actual); |
||
| 36 | |||
| 37 | // 3rd |
||
| 38 | $expected->id = null; |
||
| 39 | $expected->params = []; |
||
| 40 | |||
| 41 | $actual = clone $expected; |
||
| 42 | $actual->setProperties([ |
||
| 43 | 'id' => null, |
||
| 44 | 'params' => [], |
||
| 45 | ]); |
||
| 46 | $this->assertEquals($expected, $actual); |
||
| 47 | } |
||
| 49 |