@@ 61-77 (lines=17) @@ | ||
58 | static::assertInstanceOf(FileModifierInterface::class, $this->reFormatter); |
|
59 | } |
|
60 | ||
61 | public function testCanModifyAcceptsFileNodeInterfaceWithAFormat() |
|
62 | { |
|
63 | $file = m::mock(FileNodeInterface::class, FormatAwareInterface::class); |
|
64 | $file->shouldReceive('exists') |
|
65 | ->andReturn(true); |
|
66 | ||
67 | $format = m::mock(FormatInterface::class); |
|
68 | $parser = m::mock(ParserInterface::class); |
|
69 | $this->parserFactory->shouldReceive('getParser') |
|
70 | ->with($format) |
|
71 | ->andReturn($parser); |
|
72 | ||
73 | $file->shouldReceive('getFormat') |
|
74 | ->andReturn($format); |
|
75 | ||
76 | static::assertTrue($this->reFormatter->canModify($file)); |
|
77 | } |
|
78 | ||
79 | public function testCanModifyDoesNotAcceptAFormatThatCanNotBeParsed() |
|
80 | { |
|
@@ 79-94 (lines=16) @@ | ||
76 | static::assertTrue($this->reFormatter->canModify($file)); |
|
77 | } |
|
78 | ||
79 | public function testCanModifyDoesNotAcceptAFormatThatCanNotBeParsed() |
|
80 | { |
|
81 | $file = m::mock(FileNodeInterface::class, FormatAwareInterface::class); |
|
82 | $file->shouldReceive('exists') |
|
83 | ->andReturn(true); |
|
84 | ||
85 | $format = m::mock(FormatInterface::class); |
|
86 | $this->parserFactory->shouldReceive('getParser') |
|
87 | ->with($format) |
|
88 | ->andReturn(null); |
|
89 | ||
90 | $file->shouldReceive('getFormat') |
|
91 | ->andReturn($format); |
|
92 | ||
93 | static::assertFalse($this->reFormatter->canModify($file)); |
|
94 | } |
|
95 | ||
96 | public function testCanReFormatWithANonLocalInputFileAndOutputFormat() |
|
97 | { |