diff --git a/tests/ResourceSyncingTest.php b/tests/ResourceSyncingTest.php index a4736ce7..3a34259d 100644 --- a/tests/ResourceSyncingTest.php +++ b/tests/ResourceSyncingTest.php @@ -958,12 +958,14 @@ test('pivot record is automatically deleted with the tenant resource', function( $syncMaster->tenants()->attach($tenant); + expect(DB::select("SELECT * FROM tenant_users WHERE tenant_id = ?", [$tenant->id]))->toHaveCount(1); + $tenant->run(function () { TenantUser::firstWhere('global_id', 'cascade_user')->delete(); }); // Deleting tenant resource deletes its pivot record - expect(DB::select("SELECT * FROM tenant_users WHERE tenant_id = ?", [$tenant->getTenantKey()]))->toHaveCount(0); + expect(DB::select("SELECT * FROM tenant_users WHERE tenant_id = ?", [$tenant->id]))->toHaveCount(0); }); test('DeleteAllTenantMappings handles incorrect configuration correctly', function() {