Skip to content

Commit

Permalink
Merge pull request #130 from Clutz88/tap-to-defer
Browse files Browse the repository at this point in the history
update calls to deprecated tap to defer
  • Loading branch information
freekmurze authored Dec 9, 2024
2 parents 5eedd97 + f4a9569 commit 03d1142
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/HasStatusesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
});

test('a reason can be set')
->tap(fn () => $this->testModel->setStatus('pending', 'waiting on action'))
->defer(fn () => $this->testModel->setStatus('pending', 'waiting on action'))
->expect(fn () => $this->testModel->status()->reason)
->toEqual('waiting on action');

Expand Down Expand Up @@ -67,12 +67,12 @@
->toBeNull();

it('can handle an empty reason when setting a status')
->tap(fn () => $this->testModel->setStatus('status'))
->defer(fn () => $this->testModel->setStatus('status'))
->expect(fn () => $this->testModel->status()->name)
->toEqual('status');

it('allows null for an empty reason when setting a status')
->tap(fn () => $this->testModel->setStatus('status', null))
->defer(fn () => $this->testModel->setStatus('status', null))
->expect(fn () => $this->testModel->status()->reason)
->toBeNull();

Expand Down Expand Up @@ -100,22 +100,22 @@
});

it('will return `true` if specific status is found')
->tap(fn () => $this->testModel->setStatus('status 1'))
->defer(fn () => $this->testModel->setStatus('status 1'))
->expect(fn () => $this->testModel->hasEverHadStatus('status 1'))
->toBeTrue();

it('will return `false` if specific status is not found')
->tap(fn () => $this->testModel->setStatus('status 1'))
->defer(fn () => $this->testModel->setStatus('status 1'))
->expect(fn () => $this->testModel->hasEverHadStatus('status 2'))
->toBeFalse();

it('will return `false` if specific status is found')
->tap(fn () => $this->testModel->setStatus('status 1'))
->defer(fn () => $this->testModel->setStatus('status 1'))
->expect(fn () => $this->testModel->hasNeverHadStatus('status 1'))
->toBeFalse();

it('will return `true` if specific status is not found')
->tap(fn () => $this->testModel->setStatus('status 1'))
->defer(fn () => $this->testModel->setStatus('status 1'))
->expect(fn () => $this->testModel->hasNeverHadStatus('status 2'))
->toBeTrue();

Expand Down Expand Up @@ -151,10 +151,10 @@
});

it('can handle a different status model')
->tap(
->defer(
fn () => config()->set('model-status.status_model', AlternativeStatusModel::class)
)
->tap(
->defer(
fn () => $this->testModel->setStatus('pending', 'waiting on action')
)
->expect(fn () => $this->testModel->status())
Expand Down Expand Up @@ -228,8 +228,8 @@
});

it('supports custom polymorphic model types')
->tap(fn () => Relation::morphMap(['custom-test-model' => TestModel::class]))
->tap(fn () => $this->testModel->setStatus('initiated'))
->defer(fn () => Relation::morphMap(['custom-test-model' => TestModel::class]))
->defer(fn () => $this->testModel->setStatus('initiated'))
->expect(fn () => TestModel::currentStatus('initiated')->get())
->toHaveCount(1);

Expand Down

0 comments on commit 03d1142

Please sign in to comment.