77use Prophecy \Argument ;
88
99use Symfony \Component \Console \Input \ArrayInput ;
10- use Task \ Plugin \Console \Output \Output ;
10+ use Symfony \ Component \Console \Output \OutputInterface ;
1111use Symfony \Component \Console \Command \Command as BaseCommand ;
1212use Task \Console \Command \Command ;
1313
@@ -35,15 +35,7 @@ function it_should_inject_a_container()
3535 })->shouldReturn ($ this ->getContainer ());
3636 }
3737
38- function it_should_run_a_task_on_demand ()
39- {
40- $ this ->addTask ('test ' , function () {
41- return 123 ;
42- });
43- $ this ->runTask ('test ' )->shouldReturn (123 );
44- }
45-
46- function it_should_run_plain_commands ()
38+ function it_should_run_plain_commands (OutputInterface $ output )
4739 {
4840 $ command = new BaseCommand ('test ' );
4941 $ command ->setCode (function () {
@@ -53,17 +45,17 @@ function it_should_run_plain_commands()
5345 $ input = new ArrayInput (['command ' => 'test ' ]);
5446
5547 $ this ->add ($ command );
56- $ this ->run ($ input )->shouldReturn (123 );
48+ $ this ->run ($ input, $ output )->shouldReturn (123 );
5749 }
5850
59- function it_should_run_a_task ()
51+ function it_should_run_a_task (OutputInterface $ output )
6052 {
6153 $ this ->addTask ('test ' , function () {
6254 return 123 ;
6355 });
6456
6557 $ input = new ArrayInput (['command ' => 'test ' ]);
66- $ this ->run ($ input )->shouldReturn (123 );
58+ $ this ->run ($ input, $ output )->shouldReturn (123 );
6759 }
6860
6961 function it_should_throw_on_no_args_to_parse ()
@@ -139,52 +131,45 @@ function it_should_add_a_command()
139131 $ this ->run (new ArrayInput (['command ' => 'test ' ]))->shouldReturn (123 );
140132 }
141133
142- function it_should_alias_a_command ()
134+ function it_should_alias_a_command (OutputInterface $ output )
143135 {
144136 $ command = new BaseCommand ('test ' );
145137 $ command ->setCode (function () {
146138 return 123 ;
147139 });
148140
149141 $ this ->addTask ('foo ' , $ command );
150- $ this ->run (new ArrayInput (['command ' => 'foo ' ]))->shouldReturn (123 );
142+ $ this ->run (new ArrayInput (['command ' => 'foo ' ]), $ output )->shouldReturn (123 );
151143 }
152144
153- function it_should_add_a_closure ()
145+ function it_should_add_a_closure (OutputInterface $ output )
154146 {
155147 $ this ->addTask ('test ' , function () {
156148 return 123 ;
157149 });
158150
159- $ this ->run (new ArrayInput (['command ' => 'test ' ]))->shouldReturn (123 );
151+ $ this ->run (new ArrayInput (['command ' => 'test ' ]), $ output )->shouldReturn (123 );
160152 }
161153
162- function it_should_inject_a_closure ()
154+ function it_should_inject_a_closure (OutputInterface $ output )
163155 {
164156 $ this ->getContainer ()['foo ' ] = $ foo = 123 ;
165157 $ this ->addTask ('test ' , ['foo ' , function ($ foo ) {
166158 return $ foo ;
167159 }]);
168160
169- $ this ->run (new ArrayInput (['command ' => 'test ' ]))->shouldReturn (123 );
161+ $ this ->run (new ArrayInput (['command ' => 'test ' ]), $ output )->shouldReturn (123 );
170162 }
171163
172- function it_should_add_a_group (Output $ output )
164+ function it_should_add_a_group (OutputInterface $ output )
173165 {
174- $ this ->getContainer ()['output ' ] = $ output ;
175- $ this ->addTask ('foo ' , ['output ' , function ($ output ) {
176- $ output ->writeln ('foo ' );
177- return null ;
178- }]);
179-
180- $ this ->addTask ('bar ' , function () {
181- return 123 ;
182- });
166+ $ this ->addTask ('foo ' , function () {});
167+ $ this ->addTask ('bar ' , function () {});
168+ $ group = $ this ->addTask ('test ' , ['foo ' , 'bar ' ]);
183169
184- $ this ->addTask ('test ' , ['foo ' , 'bar ' ]);
185-
186- $ output ->writeln ('foo ' )->shouldBeCalled ();
187- $ this ->run (new ArrayInput (['command ' => 'test ' ]), $ output )->shouldReturn (123 );
170+ $ group ->shouldHaveType ('Task\Console\Command\GroupCommand ' );
171+ $ group ->getProject ()->shouldReturn ($ this );
172+ $ group ->getTasks ()->shouldReturn (['foo ' , 'bar ' ]);
188173 }
189174
190175 function it_should_throw_on_bad_work ()
@@ -227,7 +212,7 @@ function it_should_normalize_dependencies()
227212 $ test = $ this ->addTask ('test ' , ['foo ' , 'bar ' ], function () {});
228213 $ foo = $ this ->addTask ('foo ' , ['bar ' ], function () {});
229214 $ bar = $ this ->addTask ('bar ' , function () {});
230- $ this ->resolveDependencies ($ test )->shouldEqual ([$ foo , $ bar ]);
215+ $ this ->resolveDependencies ($ test )->shouldEqual ([$ bar , $ foo ]);
231216 }
232217
233218 function it_should_normalize_complex_dependencies ()
0 commit comments