2
2
3
3
namespace Tests \Console \Commands ;
4
4
5
- use App \ Modules \ Publication \ Models \ Quote ;
5
+ use Illuminate \ Foundation \ Testing \ Concerns \ InteractsWithConsole ;
6
6
use Illuminate \Testing \PendingCommand ;
7
7
use InteractionDesignFoundation \LaravelDatabaseToolkit \Console \Commands \FindRiskyDatabaseColumns ;
8
8
use PHPUnit \Framework \Attributes \CoversClass ;
9
9
use PHPUnit \Framework \Attributes \Test ;
10
- use Tests \ApplicationTestCase ;
11
- use Tests \Factories \Publication \QuoteFactory ;
10
+ use Tests \TestCase ;
12
11
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
15
14
{
15
+ use InteractsWithConsole;
16
+
16
17
#[Test]
17
18
public function it_works_with_default_threshold (): void
18
19
{
@@ -21,17 +22,4 @@ public function it_works_with_default_threshold(): void
21
22
assert ($ pendingCommand instanceof PendingCommand);
22
23
$ pendingCommand ->assertExitCode (0 );
23
24
}
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
- }
37
25
}
0 commit comments