-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Mount Hook and allow classnames in registration * Fix styling * Update src/Lifecycle/Dispatcher.php Co-authored-by: Chris Morrell <[email protected]> * WIP * Fix styling * Add support for base class matching * Rename mount to boot * Fix styling * WIP * WIP * Fix styling * Scope down to just "boot" portion of changes * Account for Laravel bug * Fix styling * Revert for now * Fix styling --------- Co-authored-by: DanielCoulbourne <[email protected]> Co-authored-by: Chris Morrell <[email protected]>
- Loading branch information
1 parent
b178c35
commit d83543b
Showing
6 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Thunk\Verbs\Attributes\Hooks\On; | ||
use Thunk\Verbs\Event; | ||
use Thunk\Verbs\Lifecycle\Dispatcher; | ||
use Thunk\Verbs\Lifecycle\Phase; | ||
|
||
it('can modify props on events in the Boot phase', function () { | ||
app(Dispatcher::class)->register(new BootHookTestListener); | ||
|
||
$e = BootHookTestEvent::fire( | ||
album: 'Tha Carter 2' | ||
); | ||
|
||
expect($e)->name->toBe('Lil Wayne'); | ||
}); | ||
|
||
class BootHookTestEvent extends Event | ||
{ | ||
public string $name; | ||
|
||
public string $album; | ||
} | ||
|
||
class BootHookTestListener | ||
{ | ||
#[On(Phase::Boot)] | ||
public function setNameToLilWayne(BootHookTestEvent $event) | ||
{ | ||
$event->name = 'Lil Wayne'; | ||
} | ||
} |