@@ 43-58 (lines=16) @@ | ||
40 | * |
|
41 | * @return FileReader |
|
42 | */ |
|
43 | private function buildFactoryReader($stream, ParserInterface $parser) |
|
44 | { |
|
45 | $file = m::mock(FileNodeInterface::class, NodeStreamInterface::class); |
|
46 | $file->shouldReceive('getStream') |
|
47 | ->with('r') |
|
48 | ->andReturn($stream); |
|
49 | ||
50 | $format = m::mock(JsonFormat::class)->makePartial(); |
|
51 | ||
52 | $factory = m::mock(ParserFactoryInterface::class); |
|
53 | $factory->shouldReceive('getParser') |
|
54 | ->with($format) |
|
55 | ->andReturn($parser); |
|
56 | ||
57 | return new FileReader($file, $format, $factory); |
|
58 | } |
|
59 | ||
60 | public function testNodeStreamFileWillGetAStream() |
|
61 | { |
@@ 69-87 (lines=19) @@ | ||
66 | new FileWriter($file); |
|
67 | } |
|
68 | ||
69 | public function testNodeWithFormatWillUseThatFormat() |
|
70 | { |
|
71 | $stream = $this->getStream(); |
|
72 | ||
73 | $file = m::mock(FileNodeInterface::class, NodeStreamInterface::class, FormatAwareInterface::class); |
|
74 | $file->shouldReceive('getStream') |
|
75 | ->with('c+b') |
|
76 | ->andReturn($stream); |
|
77 | ||
78 | $format = m::mock(CsvFormat::class) |
|
79 | ->makePartial(); |
|
80 | ||
81 | $file->shouldReceive('getFormat') |
|
82 | ->andReturn($format); |
|
83 | ||
84 | $writer = new FileWriter($file); |
|
85 | ||
86 | static::assertInstanceOf(WriterInterface::class, $writer); |
|
87 | } |
|
88 | ||
89 | public function testProvidingAParserFactoryWillUseTheFactory() |
|
90 | { |