|
3 | 3 | use DirectoryTree\Metrics\Commands\MakeMetricsTable; |
4 | 4 | use Orchestra\Testbench\Concerns\InteractsWithPublishedFiles; |
5 | 5 |
|
| 6 | +use function Pest\Laravel\artisan; |
| 7 | + |
6 | 8 | uses(InteractsWithPublishedFiles::class); |
7 | 9 |
|
8 | 10 | it('creates a migration file with the correct name', function () { |
9 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
| 11 | + artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
10 | 12 | ->assertSuccessful(); |
11 | 13 |
|
12 | 14 | $this->assertMigrationFileExists('*_create_test_metrics_table.php'); |
13 | 15 | }); |
14 | 16 |
|
15 | 17 | it('displays success message with migration name', function () { |
16 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'user_metrics']) |
| 18 | + artisan(MakeMetricsTable::class, ['name' => 'user_metrics']) |
17 | 19 | ->expectsOutputToContain('created successfully') |
18 | 20 | ->assertSuccessful(); |
19 | 21 | }); |
20 | 22 |
|
21 | 23 | it('generates migration with correct table name in schema', function () { |
22 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'custom_metrics']) |
| 24 | + artisan(MakeMetricsTable::class, ['name' => 'custom_metrics']) |
23 | 25 | ->assertSuccessful(); |
24 | 26 |
|
25 | 27 | $this->assertMigrationFileContains([ |
|
29 | 31 | }); |
30 | 32 |
|
31 | 33 | it('generates migration with all required columns', function () { |
32 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
| 34 | + artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
33 | 35 | ->assertSuccessful(); |
34 | 36 |
|
35 | 37 | $this->assertMigrationFileContains([ |
|
47 | 49 | }); |
48 | 50 |
|
49 | 51 | it('generates migration with correct index', function () { |
50 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
| 52 | + artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
51 | 53 | ->assertSuccessful(); |
52 | 54 |
|
53 | 55 | $this->assertMigrationFileContains([ |
|
56 | 58 | }); |
57 | 59 |
|
58 | 60 | it('generates migration with up and down methods', function () { |
59 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
| 61 | + artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
60 | 62 | ->assertSuccessful(); |
61 | 63 |
|
62 | 64 | $this->assertMigrationFileContains([ |
|
66 | 68 | }); |
67 | 69 |
|
68 | 70 | it('creates migration file with timestamp prefix', function () { |
69 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
| 71 | + artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
70 | 72 | ->assertSuccessful(); |
71 | 73 |
|
72 | 74 | $this->assertMigrationFileExists('*_create_test_metrics_table.php'); |
73 | 75 | }); |
74 | 76 |
|
75 | 77 | it('can generate multiple different metrics tables', function () { |
76 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'user_metrics']) |
| 78 | + artisan(MakeMetricsTable::class, ['name' => 'user_metrics']) |
77 | 79 | ->assertSuccessful(); |
78 | 80 |
|
79 | 81 | sleep(1); // Ensure different timestamp |
80 | 82 |
|
81 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'custom_metrics']) |
| 83 | + artisan(MakeMetricsTable::class, ['name' => 'custom_metrics']) |
82 | 84 | ->assertSuccessful(); |
83 | 85 |
|
84 | 86 | $this->assertMigrationFileExists('*_create_user_metrics_table.php'); |
|
94 | 96 | }); |
95 | 97 |
|
96 | 98 | it('generates valid php migration file', function () { |
97 | | - $this->artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
| 99 | + artisan(MakeMetricsTable::class, ['name' => 'test_metrics']) |
98 | 100 | ->assertSuccessful(); |
99 | 101 |
|
100 | 102 | $this->assertMigrationFileContains([ |
|
0 commit comments