22
33namespace Tests \Console \Commands ;
44
5- use App \ Modules \ Publication \ Models \ Quote ;
5+ use Illuminate \ Foundation \ Testing \ Concerns \ InteractsWithConsole ;
66use Illuminate \Testing \PendingCommand ;
77use InteractionDesignFoundation \LaravelDatabaseToolkit \Console \Commands \FindRiskyDatabaseColumns ;
88use PHPUnit \Framework \Attributes \CoversClass ;
99use PHPUnit \Framework \Attributes \Test ;
10- use Tests \ApplicationTestCase ;
11- use Tests \Factories \Publication \QuoteFactory ;
10+ use Tests \TestCase ;
1211
13- #[CoversClass(\ App \ Modules \ Infrastructure \ Console \ Commands \ FindRiskyDatabaseColumns::class)]
14- final class FindRiskyDatabaseColumnsTest extends ApplicationTestCase
12+ #[CoversClass(FindRiskyDatabaseColumns::class)]
13+ final class FindRiskyDatabaseColumnsTest extends TestCase
1514{
15+ use InteractsWithConsole;
16+
1617 #[Test]
1718 public function it_works_with_default_threshold (): void
1819 {
@@ -21,17 +22,4 @@ public function it_works_with_default_threshold(): void
2122 assert ($ pendingCommand instanceof PendingCommand);
2223 $ pendingCommand ->assertExitCode (0 );
2324 }
24-
25- #[Test]
26- public function it_fails_on_very_low_threshold (): void
27- {
28- /** We can create {@see \App\Modules\Logging\Models\VisitorActivity} instances, but they are slow to create (too many indexes) */
29- QuoteFactory::new ()->createOne (['id ' => 42_000 ]);
30-
31- $ pendingCommand = $ this ->artisan (FindRiskyDatabaseColumns::class, ['--threshold ' => 0.001 ]);
32-
33- assert ($ pendingCommand instanceof PendingCommand);
34- $ pendingCommand ->assertExitCode (1 );
35- $ pendingCommand ->expectsOutputToContain (get_table_name (Quote::class).'.id is full for ' ); // check line like "ixdf.quote.id is 0.0148% full (threshold for allowed usage is 0.0000001%)\n"
36- }
3725}
0 commit comments