2
2
3
3
namespace IonBazan \ComposerDiff \Tests \Integration ;
4
4
5
- use Composer \Composer ;
6
- use Composer \Console \Application ;
7
5
use Composer \Factory ;
8
- use Composer \IO \IOInterface ;
9
6
use Composer \IO \NullIO ;
10
7
use Composer \Package \Package ;
11
8
use Composer \Plugin \PluginManager ;
@@ -25,9 +22,8 @@ class DiffCommandTest extends TestCase
25
22
*/
26
23
public function testCommand ($ expectedOutput , array $ input )
27
24
{
28
- $ application = new ComposerApplication ();
29
25
$ command = new DiffCommand (new PackageDiff ());
30
- $ command ->setApplication ($ application );
26
+ $ command ->setApplication ($ this -> getComposerApplication () );
31
27
$ tester = new CommandTester ($ command );
32
28
$ result = $ tester ->execute ($ input );
33
29
$ this ->assertSame (0 , $ result );
@@ -44,7 +40,7 @@ public function testCommand($expectedOutput, array $input)
44
40
public function testComposerApplication ($ expectedOutput , array $ input )
45
41
{
46
42
$ input = array_merge (array ('command ' => 'diff ' ), $ input );
47
- $ app = new ComposerApplication ();
43
+ $ app = $ this -> getComposerApplication ();
48
44
$ app ->setIO (new NullIO ()); // For Composer v1
49
45
$ app ->setAutoExit (false );
50
46
$ plugin = $ this ->getPluginPackage ();
@@ -247,16 +243,3 @@ private function getPluginPackage()
247
243
return $ plugin ;
248
244
}
249
245
}
250
-
251
- class ComposerApplication extends Application
252
- {
253
- public function setIO (IOInterface $ io )
254
- {
255
- $ this ->io = $ io ;
256
- }
257
-
258
- public function setComposer (Composer $ composer )
259
- {
260
- $ this ->composer = $ composer ;
261
- }
262
- }
0 commit comments