55use PhpSchool \PhpWorkshop \CodePatcher ;
66use PhpSchool \PhpWorkshop \Event \Event ;
77use PhpSchool \PhpWorkshop \Exercise \ExerciseInterface ;
8+ use PhpSchool \PhpWorkshop \Input \Input ;
89use PhpSchool \PhpWorkshop \Listener \CodePatchListener ;
910use PHPUnit_Framework_TestCase ;
1011use RuntimeException ;
@@ -44,11 +45,11 @@ public function setUp()
4445
4546 public function testRevertThrowsExceptionIfPatchNotPreviouslyCalled ()
4647 {
47- $ fileName = $ this ->file ;
48+ $ input = new Input ( ' app ' , [ ' program ' => $ this ->file ]) ;
4849 $ exercise = $ this ->createMock (ExerciseInterface::class);
4950
5051 $ listener = new CodePatchListener ($ this ->codePatcher );
51- $ event = new Event ('event ' , compact ('exercise ' , 'fileName ' ));
52+ $ event = new Event ('event ' , compact ('exercise ' , 'input ' ));
5253
5354 $ this ->expectException (RuntimeException::class);
5455 $ this ->expectExceptionMessage ('Can only revert previously patched code ' );
@@ -59,7 +60,7 @@ public function testPatchUpdatesCode()
5960 {
6061 file_put_contents ($ this ->file , 'ORIGINAL CONTENT ' );
6162
62- $ fileName = $ this ->file ;
63+ $ input = new Input ( ' app ' , [ ' program ' => $ this ->file ]) ;
6364 $ exercise = $ this ->createMock (ExerciseInterface::class);
6465
6566 $ this ->codePatcher
@@ -69,7 +70,7 @@ public function testPatchUpdatesCode()
6970 ->will ($ this ->returnValue ('MODIFIED CONTENT ' ));
7071
7172 $ listener = new CodePatchListener ($ this ->codePatcher );
72- $ event = new Event ('event ' , compact ('exercise ' , 'fileName ' ));
73+ $ event = new Event ('event ' , compact ('exercise ' , 'input ' ));
7374 $ listener ->patch ($ event );
7475
7576 $ this ->assertStringEqualsFile ($ this ->file , 'MODIFIED CONTENT ' );
@@ -79,7 +80,7 @@ public function testRevertAfterPatch()
7980 {
8081 file_put_contents ($ this ->file , 'ORIGINAL CONTENT ' );
8182
82- $ fileName = $ this ->file ;
83+ $ input = new Input ( ' app ' , [ ' program ' => $ this ->file ]) ;
8384 $ exercise = $ this ->createMock (ExerciseInterface::class);
8485
8586 $ this ->codePatcher
@@ -89,7 +90,7 @@ public function testRevertAfterPatch()
8990 ->will ($ this ->returnValue ('MODIFIED CONTENT ' ));
9091
9192 $ listener = new CodePatchListener ($ this ->codePatcher );
92- $ event = new Event ('event ' , compact ('exercise ' , 'fileName ' ));
93+ $ event = new Event ('event ' , compact ('exercise ' , 'input ' ));
9394 $ listener ->patch ($ event );
9495 $ listener ->revert ($ event );
9596
0 commit comments