88use PhpSchool \PhpWorkshop \Exercise \ExerciseInterface ;
99use PhpSchool \PhpWorkshop \Exercise \ExerciseType ;
1010use PhpSchool \PhpWorkshop \ExerciseCheck \ComposerExerciseCheck ;
11+ use PhpSchool \PhpWorkshop \Input \Input ;
1112use PhpSchool \PhpWorkshop \Result \Failure ;
1213use PhpSchool \PhpWorkshop \Result \Success ;
1314use PhpSchool \PhpWorkshopTest \Asset \ComposerExercise ;
@@ -47,12 +48,15 @@ public function testExceptionIsThrownIfNotValidExercise()
4748 $ exercise = $ this ->createMock (ExerciseInterface::class);
4849 $ this ->expectException (InvalidArgumentException::class);
4950
50- $ this ->check ->check ($ exercise , '' );
51+ $ this ->check ->check ($ exercise , new Input ( ' app ' ) );
5152 }
5253
5354 public function testCheckReturnsFailureIfNoComposerFile ()
5455 {
55- $ result = $ this ->check ->check ($ this ->exercise , 'invalid/solution ' );
56+ $ result = $ this ->check ->check (
57+ $ this ->exercise ,
58+ new Input ('app ' , ['program ' => 'invalid/solution ' ])
59+ );
5660
5761 $ this ->assertInstanceOf (Failure::class, $ result );
5862 $ this ->assertSame ('Composer Dependency Check ' , $ result ->getCheckName ());
@@ -61,7 +65,10 @@ public function testCheckReturnsFailureIfNoComposerFile()
6165
6266 public function testCheckReturnsFailureIfNoComposerLockFile ()
6367 {
64- $ result = $ this ->check ->check ($ this ->exercise , __DIR__ . '/../res/composer/not-locked/solution.php ' );
68+ $ result = $ this ->check ->check (
69+ $ this ->exercise ,
70+ new Input ('app ' , ['program ' => __DIR__ . '/../res/composer/not-locked/solution.php ' ])
71+ );
6572
6673 $ this ->assertInstanceOf (Failure::class, $ result );
6774 $ this ->assertSame ('Composer Dependency Check ' , $ result ->getCheckName ());
@@ -80,8 +87,8 @@ public function testCheckReturnsFailureIfDependencyNotRequired($dependency, $sol
8087 $ exercise ->expects ($ this ->once ())
8188 ->method ('getRequiredPackages ' )
8289 ->will ($ this ->returnValue ([$ dependency ]));
83-
84- $ result = $ this ->check ->check ($ exercise , $ solutionFile );
90+
91+ $ result = $ this ->check ->check ($ exercise , new Input ( ' app ' , [ ' program ' => $ solutionFile]) );
8592
8693 $ this ->assertInstanceOf (Failure::class, $ result );
8794 $ this ->assertSame ('Composer Dependency Check ' , $ result ->getCheckName ());
@@ -104,7 +111,10 @@ public function dependencyProvider()
104111
105112 public function testCheckReturnsSuccessIfCorrectLockFile ()
106113 {
107- $ result = $ this ->check ->check ($ this ->exercise , __DIR__ . '/../res/composer/good-solution/solution.php ' );
114+ $ result = $ this ->check ->check (
115+ $ this ->exercise ,
116+ new Input ('app ' , ['program ' => __DIR__ . '/../res/composer/good-solution/solution.php ' ])
117+ );
108118
109119 $ this ->assertInstanceOf (Success::class, $ result );
110120 $ this ->assertSame ('Composer Dependency Check ' , $ result ->getCheckName ());
0 commit comments