| Conditions | 1 |
| Paths | 1 |
| Total Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function testTransform() |
||
| 17 | { |
||
| 18 | $fooHydrator = $this->getMockBuilder(HydratorInterface::class) |
||
| 19 | ->setMethods(['toMessage', 'supports']) |
||
| 20 | ->getMock(); |
||
| 21 | |||
| 22 | $version = 2; |
||
| 23 | $identifier = 'foobar'; |
||
| 24 | $payload = ['foo' => 'bar']; |
||
| 25 | $time = \time(); |
||
| 26 | $data = [ |
||
| 27 | 'version' => $version, |
||
| 28 | 'identifier' => $identifier, |
||
| 29 | 'payload' => $payload, |
||
| 30 | 'timestamp' => $time, |
||
| 31 | ]; |
||
| 32 | |||
| 33 | $fooHydrator->expects(self::once()) |
||
| 34 | ->method('supports') |
||
| 35 | ->with($identifier, $version) |
||
| 36 | ->willReturn(true); |
||
| 37 | |||
| 38 | $fooHydrator->expects(self::once()) |
||
| 39 | ->method('toMessage') |
||
| 40 | ->with($payload, $version) |
||
| 41 | ->willReturn(new \stdClass()); |
||
| 42 | |||
| 43 | $hydrator = new Hydrator([$fooHydrator]); |
||
| 44 | $output = $hydrator->toMessage($data); |
||
| 45 | |||
| 46 | self::assertInstanceOf(\stdClass::class, $output); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |