@@ 53-62 (lines=10) @@ | ||
50 | static::assertInstanceOf(CsvFormatter::class, $formatter); |
|
51 | } |
|
52 | ||
53 | public function testACsvFormatPretendingToBeCsvWillThrowAnException() |
|
54 | { |
|
55 | $csvFormat = m::mock(FormatInterface::class); |
|
56 | $csvFormat->shouldReceive('getType') |
|
57 | ->andReturn('csv'); |
|
58 | ||
59 | static::expectException(InvalidArgumentException::class); |
|
60 | ||
61 | $this->factory->getFormatter($csvFormat); |
|
62 | } |
|
63 | ||
64 | public function testJsonFormatter() |
|
65 | { |
|
@@ 80-89 (lines=10) @@ | ||
77 | static::assertInstanceOf(JsonFormatter::class, $formatter); |
|
78 | } |
|
79 | ||
80 | public function testAJsonFormatPretendingToBeCsvWillThrowAnException() |
|
81 | { |
|
82 | $csvFormat = m::mock(FormatInterface::class); |
|
83 | $csvFormat->shouldReceive('getType') |
|
84 | ->andReturn('json'); |
|
85 | ||
86 | static::expectException(InvalidArgumentException::class); |
|
87 | ||
88 | $this->factory->getFormatter($csvFormat); |
|
89 | } |
|
90 | ||
91 | public function testGetFormatterWithUnknownTypeWillThrowException() |
|
92 | { |
|
@@ 91-100 (lines=10) @@ | ||
88 | $this->factory->getFormatter($csvFormat); |
|
89 | } |
|
90 | ||
91 | public function testGetFormatterWithUnknownTypeWillThrowException() |
|
92 | { |
|
93 | $format = m::mock(FormatInterface::class); |
|
94 | $format->shouldReceive('getType') |
|
95 | ->andReturn('random'); |
|
96 | ||
97 | static::expectException(InvalidArgumentException::class); |
|
98 | ||
99 | $this->factory->getFormatter($format); |
|
100 | } |
|
101 | } |
|
102 |