Skip to content

Commit ca7c173

Browse files
committed
minor DatabaseTenancyBootstrapperTest polish
1 parent 0d177c7 commit ca7c173

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

tests/Bootstrappers/DatabaseTenancyBootstrapperTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
use function Stancl\Tenancy\Tests\pest;
2222

23-
$cleanup = function () {
23+
afterEach($cleanup = function () {
2424
DatabaseTenancyBootstrapper::$harden = false;
25-
};
25+
});
2626

2727
beforeEach(function () use ($cleanup) {
2828
Event::listen(TenancyInitialized::class, BootstrapTenancy::class);
@@ -31,8 +31,6 @@
3131
$cleanup();
3232
});
3333

34-
afterEach($cleanup);
35-
3634
test('harden prevents tenants from using the central database', function (bool $harden, string $connection, string $manager) {
3735
config([
3836
'tenancy.bootstrappers' => [DatabaseTenancyBootstrapper::class],
@@ -93,7 +91,7 @@
9391
'hardening disabled' => false,
9492
])->with('db_managers');
9593

96-
test('harden prevents tenants from using a database of another tenant', function (bool $harden, string $connection, string $manager) {
94+
test('harden prevents tenants from using the database of another tenant', function (bool $harden, string $connection, string $manager) {
9795
config([
9896
'tenancy.bootstrappers' => [DatabaseTenancyBootstrapper::class],
9997
"tenancy.database.managers.{$connection}" => $manager,
@@ -114,7 +112,7 @@
114112
$tenant->update(['tenancy_db_name' => $dbName]);
115113

116114
if ($harden) {
117-
// Harden blocks initialization for tenants that use a database of another tenant
115+
// Harden blocks initialization for tenants that use the database of another tenant
118116
expect(fn () => tenancy()->initialize($tenant))->toThrow(RuntimeException::class);
119117

120118
// Connection should be reverted back to central

0 commit comments

Comments
 (0)