66use PhpSchool \CliMenu \Terminal \TerminalInterface ;
77use PhpSchool \PhpWorkshop \Check \CheckInterface ;
88use PhpSchool \PhpWorkshop \ExerciseDispatcher ;
9+ use PhpSchool \PhpWorkshop \Input \Input ;
910use PhpSchool \PhpWorkshop \Output \OutputInterface ;
1011use PhpSchool \PhpWorkshop \Output \StdOutput ;
1112use PHPUnit_Framework_TestCase ;
@@ -58,7 +59,7 @@ public function testVerifyPrintsErrorIfProgramDoesNotExist()
5859 $ renderer = $ this ->createMock (ResultsRenderer::class);
5960
6061 $ command = new VerifyCommand ($ repo , $ dispatcher , $ state , $ serializer , $ output , $ renderer );
61- $ this ->assertSame (1 , $ command ->__invoke (' appname ' , $ programFile ));
62+ $ this ->assertSame (1 , $ command ->__invoke (new Input ( ' appName ' , [ ' program ' => $ programFile]) ));
6263 }
6364
6465 public function testVerifyPrintsErrorIfNoExerciseAssigned ()
@@ -80,7 +81,7 @@ public function testVerifyPrintsErrorIfNoExerciseAssigned()
8081 $ renderer = $ this ->createMock (ResultsRenderer::class);
8182
8283 $ command = new VerifyCommand ($ repo , $ dispatcher , $ state , $ serializer , $ output , $ renderer );
83- $ this ->assertSame (1 , $ command ->__invoke (' appname ' , $ file ));
84+ $ this ->assertSame (1 , $ command ->__invoke (new Input ( ' appName ' , [ ' program ' => $ file]) ));
8485
8586 unlink ($ file );
8687 }
@@ -90,6 +91,8 @@ public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess()
9091 $ file = tempnam (sys_get_temp_dir (), 'pws ' );
9192 touch ($ file );
9293
94+ $ input = new Input ('appName ' , ['program ' => $ file ]);
95+
9396 $ e = $ this ->createMock (ExerciseInterface::class);
9497 $ e ->expects ($ this ->any ())
9598 ->method ('getName ' )
@@ -117,17 +120,17 @@ public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess()
117120 $ dispatcher
118121 ->expects ($ this ->once ())
119122 ->method ('verify ' )
120- ->with ($ e , $ file )
123+ ->with ($ e , $ input )
121124 ->will ($ this ->returnValue ($ results ));
122125
123126 $ renderer
124127 ->expects ($ this ->once ())
125128 ->method ('render ' )
126129 ->with ($ results , $ e , $ state , $ output );
127-
130+
128131
129132 $ command = new VerifyCommand ($ repo , $ dispatcher , $ state , $ serializer , $ output , $ renderer );
130- $ this ->assertEquals (0 , $ command ->__invoke (' appname ' , $ file ));
133+ $ this ->assertEquals (0 , $ command ->__invoke ($ input ));
131134 $ this ->assertEquals (['exercise1 ' ], $ state ->getCompletedExercises ());
132135 unlink ($ file );
133136 }
@@ -137,6 +140,8 @@ public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFail
137140 $ file = tempnam (sys_get_temp_dir (), 'pws ' );
138141 touch ($ file );
139142
143+ $ input = new Input ('appName ' , ['program ' => $ file ]);
144+
140145 $ e = $ this ->createMock (ExerciseInterface::class);
141146 $ e ->expects ($ this ->any ())
142147 ->method ('getName ' )
@@ -165,7 +170,7 @@ public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFail
165170 $ dispatcher
166171 ->expects ($ this ->once ())
167172 ->method ('verify ' )
168- ->with ($ e , $ file )
173+ ->with ($ e , $ input )
169174 ->will ($ this ->returnValue ($ results ));
170175
171176 $ renderer
@@ -174,7 +179,7 @@ public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFail
174179 ->with ($ results , $ e , $ state , $ output );
175180
176181 $ command = new VerifyCommand ($ repo , $ dispatcher , $ state , $ serializer , $ output , $ renderer );
177- $ this ->assertEquals (1 , $ command ->__invoke (' appname ' , $ file ));
182+ $ this ->assertEquals (1 , $ command ->__invoke ($ input ));
178183 $ this ->assertEquals ([], $ state ->getCompletedExercises ());
179184 unlink ($ file );
180185 }
0 commit comments