Skip to content

Commit

Permalink
Rename to fireAndCommit for now
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Dec 7, 2023
1 parent a064533 commit 1aebb83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* @method static static fire(...$args)
* @method static mixed fireNow(...$args)
* @method static mixed fireAndCommit(...$args)
*/
abstract class Event
{
Expand Down
3 changes: 2 additions & 1 deletion src/Support/PendingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public function fire(...$args): Event
}
}

public function fireNow(...$args): mixed
// FIXME: This name *may* change, so be prepared to refactor
public function fireAndCommit(...$args): mixed
{
$event = $this->fire(...$args);

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/EventApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
->and($event_queue[0])->toBe($user_registered);
});

it('immediately commits, and returns the results of handle when you call Event::fireNow', function () {
$result = UserRegistered::fireNow();
it('immediately commits, and returns the results of handle when you call Event::fireAndCommit', function () {
$result = UserRegistered::fireAndCommit();

expect($result)->toBeInstanceOf(stdClass::class)
->and($result->name)->toBe('Chris')
Expand Down

0 comments on commit 1aebb83

Please sign in to comment.