Skip to content

Commit

Permalink
adding test for post hooks after die/exit (#110)
Browse files Browse the repository at this point in the history
test that post hooks still execute after die/exit is called
  • Loading branch information
brettmc committed Nov 15, 2023
1 parent 1dbb6ac commit 0458f76
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ext/tests/post_hooks_after_die.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
Calling die/exit still executes post hooks
--EXTENSIONS--
opentelemetry
--FILE--

<?php

use function OpenTelemetry\Instrumentation\hook;

function goodbye() {
var_dump('goodbye');
die;
}

\OpenTelemetry\Instrumentation\hook(null, 'goodbye', fn() => var_dump('PRE'), fn() => var_dump('POST'));

goodbye();
?>

--EXPECT--
string(3) "PRE"
string(7) "goodbye"
string(4) "POST"

0 comments on commit 0458f76

Please sign in to comment.