mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:14:04 +00:00
Rename pullPendingTenant to pullPending and don't pass bool to that method
This commit is contained in:
parent
e172408576
commit
1899429723
2 changed files with 7 additions and 7 deletions
|
|
@ -69,13 +69,13 @@ trait HasPending
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Pull a pending tenant. */
|
/** Pull a pending tenant. */
|
||||||
public static function pullPendingTenant(): Tenant
|
public static function pullPending(): Tenant
|
||||||
{
|
{
|
||||||
return static::pullPendingTenantFromPool(true);
|
return static::pullPendingFromPool(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Try to pull a tenant from the pool of pending tenants. */
|
/** Try to pull a tenant from the pool of pending tenants. */
|
||||||
public static function pullPendingTenantFromPool(bool $firstOrCreate = false): ?Tenant
|
public static function pullPendingFromPool(bool $firstOrCreate = false): ?Tenant
|
||||||
{
|
{
|
||||||
if (! static::onlyPending()->exists()) {
|
if (! static::onlyPending()->exists()) {
|
||||||
if (! $firstOrCreate) {
|
if (! $firstOrCreate) {
|
||||||
|
|
|
||||||
|
|
@ -95,17 +95,17 @@ test('tenancy can check for pending tenants', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tenancy can pull a pending tenant', function () {
|
test('tenancy can pull a pending tenant', function () {
|
||||||
expect(Tenant::pullPendingTenant())->toBeNull();
|
expect(Tenant::pullPending())->toBeNull();
|
||||||
|
|
||||||
Tenant::createPending();
|
Tenant::createPending();
|
||||||
|
|
||||||
expect(Tenant::pullPendingTenant(true))->toBeInstanceOf(Tenant::class);
|
expect(Tenant::pullPending())->toBeInstanceOf(Tenant::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tenancy can create if none are pending', function () {
|
test('tenancy can create if none are pending', function () {
|
||||||
expect(Tenant::all()->count())->toBe(0);
|
expect(Tenant::all()->count())->toBe(0);
|
||||||
|
|
||||||
Tenant::pullPendingTenant(true);
|
Tenant::pullPending();
|
||||||
|
|
||||||
expect(Tenant::all()->count())->toBe(1);
|
expect(Tenant::all()->count())->toBe(1);
|
||||||
});
|
});
|
||||||
|
|
@ -136,7 +136,7 @@ test('pending events are dispatched', function () {
|
||||||
Event::assertDispatched(CreatingPendingTenant::class);
|
Event::assertDispatched(CreatingPendingTenant::class);
|
||||||
Event::assertDispatched(PendingTenantCreated::class);
|
Event::assertDispatched(PendingTenantCreated::class);
|
||||||
|
|
||||||
Tenant::pullPendingTenant();
|
Tenant::pullPending();
|
||||||
|
|
||||||
Event::assertDispatched(PullingPendingTenant::class);
|
Event::assertDispatched(PullingPendingTenant::class);
|
||||||
Event::assertDispatched(PendingTenantPulled::class);
|
Event::assertDispatched(PendingTenantPulled::class);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue