From 2a8a473888ef68415c9b83bf2c653ee64f81f3eb Mon Sep 17 00:00:00 2001 From: yaozm Date: Thu, 6 Jun 2024 16:21:22 +0800 Subject: [PATCH] test(commands): add test for ScoreCommand - Added a new test file ScoreCommandTest.php - Added a test case to check the scores of given SQL statements - Used Pest Laravel for testing framework --- tests/Commands/ScoreCommandTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/Commands/ScoreCommandTest.php diff --git a/tests/Commands/ScoreCommandTest.php b/tests/Commands/ScoreCommandTest.php new file mode 100644 index 0000000..655935f --- /dev/null +++ b/tests/Commands/ScoreCommandTest.php @@ -0,0 +1,24 @@ + + * + * This source file is subject to the MIT license that is bundled. + */ + +namespace Tests\Facades; + +use Guanguans\LaravelSoar\Commands\ScoreCommand; +use Symfony\Component\Console\Command\Command; + +use function Pest\Laravel\artisan; + +it('can get the scores of the given SQL statements', function (): void { + artisan(ScoreCommand::class) + ->expectsQuestion('Please input the SQL statements', 'select * from foo; select * from bar;') + ->assertExitCode(Command::SUCCESS); +})->group(__DIR__, __FILE__);