Skip to content

Commit

Permalink
test: Add RunCommandTest and update ScoreCommandTest
Browse files Browse the repository at this point in the history
- Added RunCommandTest to test running Soar with given options
- Updated ScoreCommandTest to test getting Soar scores of SQL statements
  • Loading branch information
guanguans committed Jun 7, 2024
1 parent a18a213 commit aadba22
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions tests/Commands/RunCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/laravel-soar.
*
* (c) guanguans <ityaozm@gmail.com>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Tests\Facades;

use Guanguans\LaravelSoar\Commands\RunCommand;
use Symfony\Component\Console\Command\Command;

use function Pest\Laravel\artisan;

it('can run Soar with the given options', function (): void {
artisan(
RunCommand::class,
[
'--option' => [
'-verbose=true',
'-help=true',
],
'--verbose' => true,
]
)->assertExitCode(Command::SUCCESS);
})->group(__DIR__, __FILE__);
2 changes: 1 addition & 1 deletion tests/Commands/ScoreCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use function Pest\Laravel\artisan;

it('can get the scores of the given SQL statements', function (): void {
it('can get the Soar 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);
Expand Down

0 comments on commit aadba22

Please sign in to comment.