Skip to content

Commit e1f2334

Browse files
committed
refactor: anonymous class for migration
1 parent a62a6a1 commit e1f2334

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

migrations/create_push_subscriptions_table.php.stub

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Database\Migrations\Migration;
66

7-
class CreatePushSubscriptionsTable extends Migration
7+
return new class extends Migration
88
{
99
/**
1010
* Run the migrations.
@@ -33,4 +33,4 @@ class CreatePushSubscriptionsTable extends Migration
3333
{
3434
Schema::connection(config('webpush.database_connection'))->dropIfExists(config('webpush.table_name'));
3535
}
36-
}
36+
};

tests/TestCase.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ protected function setUpDatabase()
5353
$table->string('email');
5454
});
5555

56-
include_once __DIR__.'/../migrations/create_push_subscriptions_table.php.stub';
57-
58-
(new \CreatePushSubscriptionsTable)->up();
56+
$migration = require __DIR__.'/../migrations/create_push_subscriptions_table.php.stub';
57+
$migration->up();
5958

6059
$this->createUser(['email' => 'test@user.com']);
6160
}

0 commit comments

Comments
 (0)