Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function testAddingMethod() |
||
18 | { |
||
19 | $object = new DynamicObject(); |
||
20 | $expected = mt_rand(); |
||
21 | $method = function () use ($expected) { |
||
22 | return $expected; |
||
23 | }; |
||
24 | $object->injectMethod('test', $method); |
||
25 | $res = $object->{'test'}(); |
||
26 | $this->assertEquals($expected, $res); |
||
27 | |||
28 | $object->{'js'} = $method; |
||
29 | $res = $object->{'js'}(); |
||
30 | $this->assertEquals($expected, $res); |
||
31 | } |
||
32 | |||
56 | } |