Skip to content

Commit

Permalink
test remove self
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Apr 1, 2024
1 parent 3d7ac85 commit 2af3b41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/HookTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,18 @@ public function testUpdateWhenActive(): void

$priority = 10;
$ind = $m->onHook('spot', static fn () => 'x', [], $priority);
$m->onHook('spot', static function () use ($m, $priority, $ind, &$ind2) {
$ind2 = $m->onHook('spot', static function () use ($m, $priority, $ind, &$ind2, &$ind3) {
$m->onHook('spot', static fn () => 'ya', [], $priority);

$m->removeHook('spot', $ind, true);
$m->removeHook('spot', $ind2, true); // @phpstan-ignore-line
$m->removeHook('spot', $ind2, true);
$m->removeHook('spot', $ind3, true); // @phpstan-ignore-line

$m->onHook('spot', static fn () => 'yb', [], $priority);

return 'y';
}, [], $priority);
$ind2 = $m->onHook('spot', static fn () => 'z', [], $priority);
$ind3 = $m->onHook('spot', static fn () => 'z', [], $priority);

$ret = $m->hook('spot');

Expand Down

0 comments on commit 2af3b41

Please sign in to comment.