@@ -26,219 +26,219 @@ protected function tearDown(): void
2626
2727 public function testAddSetsLaravelInstance ()
2828 {
29- $ app = $ this ->getMockConsole (['addToParent ' ]);
29+ $ artisan = $ this ->getMockConsole (['addToParent ' ]);
3030 $ command = m::mock (Command::class);
3131 $ command ->shouldReceive ('setLaravel ' )->once ()->with (m::type (ApplicationContract::class));
32- $ app ->expects ($ this ->once ())->method ('addToParent ' )->with ($ this ->equalTo ($ command ))->willReturn ($ command );
33- $ result = $ app ->add ($ command );
32+ $ artisan ->expects ($ this ->once ())->method ('addToParent ' )->with ($ this ->equalTo ($ command ))->willReturn ($ command );
33+ $ result = $ artisan ->add ($ command );
3434
35- $ this ->assertEquals ($ command , $ result );
35+ $ this ->assertSame ($ command , $ result );
3636 }
3737
3838 public function testLaravelNotSetOnSymfonyCommands ()
3939 {
40- $ app = $ this ->getMockConsole (['addToParent ' ]);
40+ $ artisan = $ this ->getMockConsole (['addToParent ' ]);
4141 $ command = m::mock (SymfonyCommand::class);
4242 $ command ->shouldReceive ('setLaravel ' )->never ();
43- $ app ->expects ($ this ->once ())->method ('addToParent ' )->with ($ this ->equalTo ($ command ))->willReturn ($ command );
44- $ result = $ app ->add ($ command );
43+ $ artisan ->expects ($ this ->once ())->method ('addToParent ' )->with ($ this ->equalTo ($ command ))->willReturn ($ command );
44+ $ result = $ artisan ->add ($ command );
4545
46- $ this ->assertEquals ($ command , $ result );
46+ $ this ->assertSame ($ command , $ result );
4747 }
4848
4949 public function testResolveAddsCommandViaApplicationResolution ()
5050 {
51- $ app = $ this ->getMockConsole (['addToParent ' ]);
51+ $ artisan = $ this ->getMockConsole (['addToParent ' ]);
5252 $ command = m::mock (SymfonyCommand::class);
53- $ app ->getLaravel ()->shouldReceive ('make ' )->once ()->with ('foo ' )->andReturn (m::mock (SymfonyCommand::class));
54- $ app ->expects ($ this ->once ())->method ('addToParent ' )->with ($ this ->equalTo ($ command ))->willReturn ($ command );
55- $ result = $ app ->resolve ('foo ' );
53+ $ artisan ->getLaravel ()->shouldReceive ('make ' )->once ()->with ('foo ' )->andReturn (m::mock (SymfonyCommand::class));
54+ $ artisan ->expects ($ this ->once ())->method ('addToParent ' )->with ($ this ->equalTo ($ command ))->willReturn ($ command );
55+ $ result = $ artisan ->resolve ('foo ' );
5656
57- $ this ->assertEquals ($ command , $ result );
57+ $ this ->assertSame ($ command , $ result );
5858 }
5959
6060 public function testResolvingCommandsWithAliasViaAttribute ()
6161 {
6262 $ container = new FoundationApplication ();
63- $ app = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
64- $ app ->resolve (CommandWithAliasViaAttribute::class);
65- $ app ->setContainerCommandLoader ();
66-
67- $ this ->assertInstanceOf (CommandWithAliasViaAttribute::class, $ app ->get ('command-name ' ));
68- $ this ->assertInstanceOf (CommandWithAliasViaAttribute::class, $ app ->get ('command-alias ' ));
69- $ this ->assertArrayHasKey ('command-name ' , $ app ->all ());
70- $ this ->assertArrayHasKey ('command-alias ' , $ app ->all ());
63+ $ artisan = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
64+ $ artisan ->resolve (CommandWithAliasViaAttribute::class);
65+ $ artisan ->setContainerCommandLoader ();
66+
67+ $ this ->assertInstanceOf (CommandWithAliasViaAttribute::class, $ artisan ->get ('command-name ' ));
68+ $ this ->assertInstanceOf (CommandWithAliasViaAttribute::class, $ artisan ->get ('command-alias ' ));
69+ $ this ->assertArrayHasKey ('command-name ' , $ artisan ->all ());
70+ $ this ->assertArrayHasKey ('command-alias ' , $ artisan ->all ());
7171 }
7272
7373 public function testResolvingCommandsWithAliasViaProperty ()
7474 {
7575 $ container = new FoundationApplication ();
76- $ app = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
77- $ app ->resolve (CommandWithAliasViaProperty::class);
78- $ app ->setContainerCommandLoader ();
79-
80- $ this ->assertInstanceOf (CommandWithAliasViaProperty::class, $ app ->get ('command-name ' ));
81- $ this ->assertInstanceOf (CommandWithAliasViaProperty::class, $ app ->get ('command-alias ' ));
82- $ this ->assertArrayHasKey ('command-name ' , $ app ->all ());
83- $ this ->assertArrayHasKey ('command-alias ' , $ app ->all ());
76+ $ artisan = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
77+ $ artisan ->resolve (CommandWithAliasViaProperty::class);
78+ $ artisan ->setContainerCommandLoader ();
79+
80+ $ this ->assertInstanceOf (CommandWithAliasViaProperty::class, $ artisan ->get ('command-name ' ));
81+ $ this ->assertInstanceOf (CommandWithAliasViaProperty::class, $ artisan ->get ('command-alias ' ));
82+ $ this ->assertArrayHasKey ('command-name ' , $ artisan ->all ());
83+ $ this ->assertArrayHasKey ('command-alias ' , $ artisan ->all ());
8484 }
8585
8686 public function testResolvingCommandsWithNoAliasViaAttribute ()
8787 {
8888 $ container = new FoundationApplication ();
89- $ app = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
90- $ app ->resolve (CommandWithNoAliasViaAttribute::class);
91- $ app ->setContainerCommandLoader ();
89+ $ artisan = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
90+ $ artisan ->resolve (CommandWithNoAliasViaAttribute::class);
91+ $ artisan ->setContainerCommandLoader ();
9292
93- $ this ->assertInstanceOf (CommandWithNoAliasViaAttribute::class, $ app ->get ('command-name ' ));
93+ $ this ->assertInstanceOf (CommandWithNoAliasViaAttribute::class, $ artisan ->get ('command-name ' ));
9494 try {
95- $ app ->get ('command-alias ' );
95+ $ artisan ->get ('command-alias ' );
9696 $ this ->fail ();
9797 } catch (Throwable $ e ) {
9898 $ this ->assertInstanceOf (CommandNotFoundException::class, $ e );
9999 }
100- $ this ->assertArrayHasKey ('command-name ' , $ app ->all ());
101- $ this ->assertArrayNotHasKey ('command-alias ' , $ app ->all ());
100+ $ this ->assertArrayHasKey ('command-name ' , $ artisan ->all ());
101+ $ this ->assertArrayNotHasKey ('command-alias ' , $ artisan ->all ());
102102 }
103103
104104 public function testResolvingCommandsWithNoAliasViaProperty ()
105105 {
106106 $ container = new FoundationApplication ();
107- $ app = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
108- $ app ->resolve (CommandWithNoAliasViaProperty::class);
109- $ app ->setContainerCommandLoader ();
107+ $ artisan = new Application ($ container , new EventsDispatcher ($ container ), $ container ->version ());
108+ $ artisan ->resolve (CommandWithNoAliasViaProperty::class);
109+ $ artisan ->setContainerCommandLoader ();
110110
111- $ this ->assertInstanceOf (CommandWithNoAliasViaProperty::class, $ app ->get ('command-name ' ));
111+ $ this ->assertInstanceOf (CommandWithNoAliasViaProperty::class, $ artisan ->get ('command-name ' ));
112112 try {
113- $ app ->get ('command-alias ' );
113+ $ artisan ->get ('command-alias ' );
114114 $ this ->fail ();
115115 } catch (Throwable $ e ) {
116116 $ this ->assertInstanceOf (CommandNotFoundException::class, $ e );
117117 }
118- $ this ->assertArrayHasKey ('command-name ' , $ app ->all ());
119- $ this ->assertArrayNotHasKey ('command-alias ' , $ app ->all ());
118+ $ this ->assertArrayHasKey ('command-name ' , $ artisan ->all ());
119+ $ this ->assertArrayNotHasKey ('command-alias ' , $ artisan ->all ());
120120 }
121121
122122 public function testCallFullyStringCommandLine ()
123123 {
124- $ app = new Application (
125- $ app = m::mock (ApplicationContract::class, ['version ' => '6.0 ' ]),
126- $ events = m::mock (Dispatcher::class, ['dispatch ' => null , ' fire ' => null ]),
124+ $ artisan = new Application (
125+ m::mock (ApplicationContract::class, ['version ' => '6.0 ' ]),
126+ m::mock (Dispatcher::class, ['dispatch ' => null ]),
127127 'testing '
128128 );
129129
130- $ codeOfCallingArrayInput = $ app ->call ('help ' , [
130+ $ codeOfCallingArrayInput = $ artisan ->call ('help ' , [
131131 '--raw ' => true ,
132132 '--format ' => 'txt ' ,
133133 '--no-interaction ' => true ,
134134 '--env ' => 'testing ' ,
135135 ]);
136136
137- $ outputOfCallingArrayInput = $ app ->output ();
137+ $ outputOfCallingArrayInput = $ artisan ->output ();
138138
139- $ codeOfCallingStringInput = $ app ->call (
139+ $ codeOfCallingStringInput = $ artisan ->call (
140140 'help --raw --format=txt --no-interaction --env=testing '
141141 );
142142
143- $ outputOfCallingStringInput = $ app ->output ();
143+ $ outputOfCallingStringInput = $ artisan ->output ();
144144
145145 $ this ->assertSame ($ codeOfCallingArrayInput , $ codeOfCallingStringInput );
146146 $ this ->assertSame ($ outputOfCallingArrayInput , $ outputOfCallingStringInput );
147147 }
148148
149149 public function testCommandInputPromptsWhenRequiredArgumentIsMissing ()
150150 {
151- $ app = new Application (
151+ $ artisan = new Application (
152152 $ laravel = new \Illuminate \Foundation \Application (__DIR__ ),
153- $ events = m::mock (Dispatcher::class, ['dispatch ' => null , ' fire ' => null ]),
153+ m::mock (Dispatcher::class, ['dispatch ' => null ]),
154154 'testing '
155155 );
156156
157- $ app ->addCommands ([$ command = new FakeCommandWithInputPrompting ()]);
157+ $ artisan ->addCommands ([$ command = new FakeCommandWithInputPrompting ()]);
158158
159159 $ command ->setLaravel ($ laravel );
160160
161- $ statusCode = $ app ->call ('fake-command-for-testing ' );
161+ $ exitCode = $ artisan ->call ('fake-command-for-testing ' );
162162
163163 $ this ->assertTrue ($ command ->prompted );
164164 $ this ->assertSame ('foo ' , $ command ->argument ('name ' ));
165- $ this ->assertSame (0 , $ statusCode );
165+ $ this ->assertSame (0 , $ exitCode );
166166 }
167167
168168 public function testCommandInputDoesntPromptWhenRequiredArgumentIsPassed ()
169169 {
170- $ app = new Application (
171- $ app = new \Illuminate \Foundation \Application (__DIR__ ),
172- $ events = m::mock (Dispatcher::class, ['dispatch ' => null , ' fire ' => null ]),
170+ $ artisan = new Application (
171+ new \Illuminate \Foundation \Application (__DIR__ ),
172+ m::mock (Dispatcher::class, ['dispatch ' => null ]),
173173 'testing '
174174 );
175175
176- $ app ->addCommands ([$ command = new FakeCommandWithInputPrompting ()]);
176+ $ artisan ->addCommands ([$ command = new FakeCommandWithInputPrompting ()]);
177177
178- $ statusCode = $ app ->call ('fake-command-for-testing ' , [
178+ $ exitCode = $ artisan ->call ('fake-command-for-testing ' , [
179179 'name ' => 'foo ' ,
180180 ]);
181181
182182 $ this ->assertFalse ($ command ->prompted );
183183 $ this ->assertSame ('foo ' , $ command ->argument ('name ' ));
184- $ this ->assertSame (0 , $ statusCode );
184+ $ this ->assertSame (0 , $ exitCode );
185185 }
186186
187187 public function testCommandInputPromptsWhenRequiredArgumentsAreMissing ()
188188 {
189- $ app = new Application (
189+ $ artisan = new Application (
190190 $ laravel = new \Illuminate \Foundation \Application (__DIR__ ),
191- $ events = m::mock (Dispatcher::class, ['dispatch ' => null , ' fire ' => null ]),
191+ m::mock (Dispatcher::class, ['dispatch ' => null ]),
192192 'testing '
193193 );
194194
195- $ app ->addCommands ([$ command = new FakeCommandWithArrayInputPrompting ()]);
195+ $ artisan ->addCommands ([$ command = new FakeCommandWithArrayInputPrompting ()]);
196196
197197 $ command ->setLaravel ($ laravel );
198198
199- $ statusCode = $ app ->call ('fake-command-for-testing-array ' );
199+ $ exitCode = $ artisan ->call ('fake-command-for-testing-array ' );
200200
201201 $ this ->assertTrue ($ command ->prompted );
202202 $ this ->assertSame (['foo ' ], $ command ->argument ('names ' ));
203- $ this ->assertSame (0 , $ statusCode );
203+ $ this ->assertSame (0 , $ exitCode );
204204 }
205205
206206 public function testCommandInputDoesntPromptWhenRequiredArgumentsArePassed ()
207207 {
208- $ app = new Application (
209- $ app = new \Illuminate \Foundation \Application (__DIR__ ),
210- $ events = m::mock (Dispatcher::class, ['dispatch ' => null , ' fire ' => null ]),
208+ $ artisan = new Application (
209+ new \Illuminate \Foundation \Application (__DIR__ ),
210+ m::mock (Dispatcher::class, ['dispatch ' => null ]),
211211 'testing '
212212 );
213213
214- $ app ->addCommands ([$ command = new FakeCommandWithArrayInputPrompting ()]);
214+ $ artisan ->addCommands ([$ command = new FakeCommandWithArrayInputPrompting ()]);
215215
216- $ statusCode = $ app ->call ('fake-command-for-testing-array ' , [
216+ $ exitCode = $ artisan ->call ('fake-command-for-testing-array ' , [
217217 'names ' => ['foo ' , 'bar ' , 'baz ' ],
218218 ]);
219219
220220 $ this ->assertFalse ($ command ->prompted );
221221 $ this ->assertSame (['foo ' , 'bar ' , 'baz ' ], $ command ->argument ('names ' ));
222- $ this ->assertSame (0 , $ statusCode );
222+ $ this ->assertSame (0 , $ exitCode );
223223 }
224224
225225 public function testCallMethodCanCallArtisanCommandUsingCommandClassObject ()
226226 {
227- $ app = new Application (
227+ $ artisan = new Application (
228228 $ laravel = new \Illuminate \Foundation \Application (__DIR__ ),
229- $ events = m::mock (Dispatcher::class, ['dispatch ' => null , ' fire ' => null ]),
229+ m::mock (Dispatcher::class, ['dispatch ' => null ]),
230230 'testing '
231231 );
232232
233- $ app ->addCommands ([$ command = new FakeCommandWithInputPrompting ()]);
233+ $ artisan ->addCommands ([$ command = new FakeCommandWithInputPrompting ()]);
234234
235235 $ command ->setLaravel ($ laravel );
236236
237- $ statusCode = $ app ->call ($ command );
237+ $ exitCode = $ artisan ->call ($ command );
238238
239239 $ this ->assertTrue ($ command ->prompted );
240240 $ this ->assertSame ('foo ' , $ command ->argument ('name ' ));
241- $ this ->assertSame (0 , $ statusCode );
241+ $ this ->assertSame (0 , $ exitCode );
242242 }
243243
244244 protected function getMockConsole (array $ methods )
0 commit comments