|
268 | 268 | expect($fn)->toThrow(QueryException::class); |
269 | 269 | })->with([true, false]); |
270 | 270 |
|
271 | | -test('pending tenant databases can be migrated using a job unless configured otherwise', function (bool $includeInQueries, bool $migrateWithPending) { |
| 271 | +test('pending tenant databases can be migrated using a job unless configured otherwise', function (bool $includeInQueries, ?bool $migrateWithPending) { |
272 | 272 | config([ |
273 | 273 | 'tenancy.bootstrappers' => [DatabaseTenancyBootstrapper::class], |
274 | 274 | 'tenancy.pending.include_in_queries' => $includeInQueries, |
|
293 | 293 |
|
294 | 294 | // MigrateDatabase includes/excludes pending tenants based on its $includePending property, |
295 | 295 | // regardless of the tenancy.pending.include_in_queries config. |
296 | | - expect(Schema::hasTable('users'))->toBe($migrateWithPending); |
| 296 | + expect(Schema::hasTable('users'))->toBe($migrateWithPending ?? $includeInQueries); |
297 | 297 | })->with([ |
298 | 298 | 'include pending in queries' => [true], |
299 | 299 | 'exclude pending from queries' => [false], |
300 | 300 | ])->with([ |
301 | 301 | 'migrate with pending' => [true], |
302 | 302 | 'migrate without pending' => [false], |
| 303 | + 'default to config' => [null], |
303 | 304 | ]); |
304 | 305 |
|
305 | | -test('pending tenant databases can be seeded using a job unless configured otherwise', function ($includeInQueries, $seedWithPending) { |
| 306 | +test('pending tenant databases can be seeded using a job unless configured otherwise', function (bool $includeInQueries, ?bool $seedWithPending) { |
306 | 307 | config([ |
307 | 308 | 'tenancy.bootstrappers' => [DatabaseTenancyBootstrapper::class], |
308 | 309 | 'tenancy.pending.include_in_queries' => $includeInQueries, |
|
328 | 329 |
|
329 | 330 | // SeedDatabase includes/excludes pending tenants based on its $includePending property, |
330 | 331 | // regardless of the tenancy.pending.include_in_queries config. |
331 | | - expect(User::where('email', 'seeded@user')->exists())->toBe($seedWithPending); |
| 332 | + expect(User::where('email', 'seeded@user')->exists())->toBe($seedWithPending ?? $includeInQueries); |
332 | 333 | })->with([ |
333 | 334 | 'include pending in queries' => [true], |
334 | 335 | 'exclude pending from queries' => [false], |
335 | 336 | ])->with([ |
336 | 337 | 'seed with pending' => [true], |
337 | 338 | 'seed without pending' => [false], |
| 339 | + 'default to config' => [null], |
338 | 340 | ]); |
339 | 341 |
|
340 | 342 | test('jobs that run before tenants get fully created recognize pending tenants', function () { |
|
0 commit comments