1414
1515use MoodlePluginCI \Process \Execute ;
1616use MoodlePluginCI \Process \MoodleProcess ;
17- use Symfony \Component \Console \Helper \DebugFormatterHelper ;
18- use Symfony \Component \Console \Helper \HelperSet ;
19- use Symfony \Component \Console \Helper \ProcessHelper ;
2017use Symfony \Component \Console \Output \BufferedOutput ;
21- use Symfony \Component \Console \Output \NullOutput ;
2218use Symfony \Component \Console \Output \OutputInterface ;
2319use Symfony \Component \Process \Exception \ProcessFailedException ;
2420use Symfony \Component \Process \Process ;
@@ -34,10 +30,7 @@ protected function setUp()
3430
3531 public function testSetNodeEnv ()
3632 {
37- $ helper = new ProcessHelper ();
38- $ helper ->setHelperSet (new HelperSet ([new DebugFormatterHelper ()]));
39-
40- $ execute = new Execute (new NullOutput (), $ helper );
33+ $ execute = new Execute ();
4134 $ pathenv = getenv ('PATH ' );
4235
4336 // RUNTIME_NVM_BIN in undefined.
@@ -69,10 +62,7 @@ public function testSetNodeEnv()
6962
7063 public function testRun ()
7164 {
72- $ helper = new ProcessHelper ();
73- $ helper ->setHelperSet (new HelperSet ([new DebugFormatterHelper ()]));
74-
75- $ execute = new Execute (new NullOutput (), $ helper );
65+ $ execute = new Execute ();
7666 $ process = $ execute ->run ('env ' );
7767
7868 $ this ->assertInstanceOf ('Symfony\Component\Process\Process ' , $ process );
@@ -83,10 +73,7 @@ public function testRun()
8373
8474 public function testMustRun ()
8575 {
86- $ helper = new ProcessHelper ();
87- $ helper ->setHelperSet (new HelperSet ([new DebugFormatterHelper ()]));
88-
89- $ execute = new Execute (new NullOutput (), $ helper );
76+ $ execute = new Execute ();
9077 $ process = $ execute ->mustRun ('env ' );
9178
9279 $ this ->assertInstanceOf ('Symfony\Component\Process\Process ' , $ process );
@@ -97,17 +84,14 @@ public function testMustRun()
9784
9885 public function testRunAllVerbose ()
9986 {
100- $ helper = new ProcessHelper ();
101- $ helper ->setHelperSet (new HelperSet ([new DebugFormatterHelper ()]));
102-
10387 /** @var Process[] $processes */
10488 $ processes = [
10589 new Process ('env ' ),
10690 new Process ('env ' ),
10791 ];
10892
10993 $ output = new BufferedOutput (OutputInterface::VERBOSITY_VERY_VERBOSE );
110- $ execute = new Execute ($ output, $ helper );
94+ $ execute = new Execute ($ output );
11195 $ execute ->runAll ($ processes );
11296
11397 foreach ($ processes as $ process ) {
@@ -120,17 +104,14 @@ public function testRunAllVerbose()
120104
121105 public function testMustRunAll ()
122106 {
123- $ helper = new ProcessHelper ();
124- $ helper ->setHelperSet (new HelperSet ([new DebugFormatterHelper ()]));
125-
126107 /** @var Process[] $processes */
127108 $ processes = [
128109 new Process ('env ' ),
129110 new MoodleProcess ('-r "echo \'PATH= \'.getenv( \'PATH \');" ' ),
130111 new Process ('env ' ),
131112 ];
132113
133- $ execute = new Execute (new NullOutput (), $ helper );
114+ $ execute = new Execute ();
134115
135116 $ execute ->parallelWaitTime = 1 ;
136117 $ execute ->mustRunAll ($ processes );
@@ -146,26 +127,22 @@ public function testMustRunAllFail()
146127 {
147128 $ this ->expectException (ProcessFailedException::class);
148129
149- $ helper = new ProcessHelper ();
150- $ helper ->setHelperSet (new HelperSet ([new DebugFormatterHelper ()]));
151-
152130 /** @var Process[] $processes */
153131 $ processes = [
154132 new Process ('php -r "echo 42;" ' ),
155133 new Process ('php -r "syntax error" ' ),
156134 new Process ('php -r "echo 42;" ' ),
157135 ];
158136
159- $ execute = new Execute (new NullOutput (), $ helper );
160-
137+ $ execute = new Execute ();
161138 $ execute ->parallelWaitTime = 1 ;
162139 $ execute ->mustRunAll ($ processes );
163140 }
164141
165142 public function testPassThrough ()
166143 {
167144 $ output = new BufferedOutput (OutputInterface::VERBOSITY_VERY_VERBOSE );
168- $ execute = new Execute ($ output, new ProcessHelper () );
145+ $ execute = new Execute ($ output );
169146 $ process = $ execute ->passThrough ('php -r "echo 42;" ' );
170147
171148 $ this ->assertInstanceOf ('Symfony\Component\Process\Process ' , $ process );
0 commit comments