@@ -139,6 +139,24 @@ public function testPerformThrowsExceptionIfCommandIsDbImport(): void
139139 $ this ->executeCommand (WpCliCommand::NAME , ['wp-command ' => ['db ' , 'import ' ], '--environment ' => 'production ' ]);
140140 }
141141
142+ public function testPerformThrowsExceptionIfCommandIsDbImportWithArguments (): void
143+ {
144+ $ this ->expectException (InvalidInputException::class);
145+ $ this ->expectExceptionMessage ('Please use the "ymir database:import" command instead of the "wp db import ./dump.sql" command ' );
146+
147+ $ this ->setupActiveTeam ();
148+ $ project = $ this ->setupValidProject (1 , 'project ' , [], 'wordpress ' , WordPressProjectType::class);
149+ $ environment = EnvironmentFactory::create (['name ' => 'production ' ]);
150+
151+ $ this ->apiClient ->shouldReceive ('getEnvironments ' )->with (\Mockery::type (Project::class))->andReturn (new ResourceCollection ([$ environment ]));
152+
153+ $ this ->bootApplication ([new WpCliCommand ($ this ->apiClient , $ this ->createExecutionContextFactory ([
154+ Environment::class => function () { return new EnvironmentDefinition (); },
155+ ]))]);
156+
157+ $ this ->executeCommand (WpCliCommand::NAME , ['wp-command ' => ['db ' , 'import ' , './dump.sql ' ], '--environment ' => 'production ' ]);
158+ }
159+
142160 public function testPerformThrowsExceptionIfCommandIsShell (): void
143161 {
144162 $ this ->expectException (InvalidInputException::class);
@@ -157,6 +175,24 @@ public function testPerformThrowsExceptionIfCommandIsShell(): void
157175 $ this ->executeCommand (WpCliCommand::NAME , ['wp-command ' => ['shell ' ], '--environment ' => 'production ' ]);
158176 }
159177
178+ public function testPerformThrowsExceptionIfCommandIsShellWithArguments (): void
179+ {
180+ $ this ->expectException (InvalidInputException::class);
181+ $ this ->expectExceptionMessage ('The "wp shell --prompt=ymir" command isn \'t available remotely ' );
182+
183+ $ this ->setupActiveTeam ();
184+ $ project = $ this ->setupValidProject (1 , 'project ' , [], 'wordpress ' , WordPressProjectType::class);
185+ $ environment = EnvironmentFactory::create (['name ' => 'production ' ]);
186+
187+ $ this ->apiClient ->shouldReceive ('getEnvironments ' )->with (\Mockery::type (Project::class))->andReturn (new ResourceCollection ([$ environment ]));
188+
189+ $ this ->bootApplication ([new WpCliCommand ($ this ->apiClient , $ this ->createExecutionContextFactory ([
190+ Environment::class => function () { return new EnvironmentDefinition (); },
191+ ]))]);
192+
193+ $ this ->executeCommand (WpCliCommand::NAME , ['wp-command ' => ['shell ' , '--prompt=ymir ' ], '--environment ' => 'production ' ]);
194+ }
195+
160196 public function testPerformThrowsExceptionIfProjectIsNotWordPress (): void
161197 {
162198 $ this ->expectException (UnsupportedProjectException::class);
0 commit comments