1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 15:24:03 +00:00

Cover invalid --with-pending values in tests

Include --with-pending=foo as the fasly option in the falsy --with-pending test.
This commit is contained in:
lukinovec 2026-04-28 12:19:09 +02:00
parent f309dcc65c
commit 0bb112dbdf

View file

@ -202,7 +202,11 @@ test('commands include pending tenants when truthy --with-pending is passed', fu
Tenant::createPending(), Tenant::createPending(),
]); ]);
foreach (['--with-pending', '--with-pending=true', '--with-pending=1'] as $option) { foreach ([
'--with-pending',
'--with-pending=true',
'--with-pending=1'
] as $option) {
$command = pest()->artisan("tenants:run 'bar testing testing@test.test password foo' {$option}"); $command = pest()->artisan("tenants:run 'bar testing testing@test.test password foo' {$option}");
// Pending tenants are included regardless of tenancy.pending.include_in_queries // Pending tenants are included regardless of tenancy.pending.include_in_queries
@ -222,7 +226,11 @@ test('commands exclude pending tenants when falsy --with-pending is passed', fun
Tenant::createPending(), Tenant::createPending(),
]); ]);
foreach (['--with-pending=false', '--with-pending=0'] as $option) { foreach ([
'--with-pending=false',
'--with-pending=0',
'--with-pending=foo' // Invalid values are treated as false
] as $option) {
$command = pest()->artisan("tenants:run 'bar testing testing@test.test password foo' {$option}"); $command = pest()->artisan("tenants:run 'bar testing testing@test.test password foo' {$option}");
$tenants->each(function ($tenant) use ($command) { $tenants->each(function ($tenant) use ($command) {