-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Class interface instrumentation (#87)
- Loading branch information
Showing
3 changed files
with
73 additions
and
4 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
42 changes: 42 additions & 0 deletions
42
prod/native/extension/phpt/tests/instrumentation_interface.phpt
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,42 @@ | ||
--TEST-- | ||
instrumentation - interface | ||
--ENV-- | ||
ELASTIC_OTEL_LOG_LEVEL_STDERR=info | ||
--INI-- | ||
extension=/elastic/elastic_otel_php.so | ||
elastic_otel.bootstrap_php_part_file={PWD}/includes/bootstrap_mock.inc | ||
--FILE-- | ||
<?php | ||
declare(strict_types=1); | ||
|
||
interface ImplementationInterface | ||
{ | ||
public function testfunc(); | ||
} | ||
|
||
class Implementation implements ImplementationInterface | ||
{ | ||
public function testfunc() | ||
{ | ||
echo "TestFunc".PHP_EOL; | ||
} | ||
} | ||
|
||
|
||
elastic_otel_hook("ImplementationInterface", "testfunc", function () { | ||
echo "*** prehook() called from impl\n"; | ||
}, function () { | ||
echo "*** posthook() called from impl\n"; | ||
}); | ||
|
||
$impl = new Implementation; | ||
|
||
$impl->testfunc(); | ||
|
||
echo "Test completed\n"; | ||
?> | ||
--EXPECTF-- | ||
*** prehook() called from impl | ||
TestFunc | ||
*** posthook() called from impl | ||
Test completed |
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