-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(agent): improve phpunit instrumentation #725
Conversation
Use file that is loaded also on PHP 8.2 with include/require optimizations that don't execute files without executable statements.
PHPUnit passes skipped tests to `addError` as well as `endTest` regardless of the version. The difference is that in PHPUnit 5.x it is not possible to obtain test outcome for skipped test - `$test.getStatus()` returns 'null'. Because of that, `endTest` instrumentation bails out and does not generate test event and therefore `addError` needs to be instrumented. It is possible to obtain test outcome for skipped tests in PHPUnit 9.x. However, the `$time` for skipped test is not received in `endTest` as a valid double and therefore it needs to be 'fixed'. Moreover testcase.getStatusMessage returns 'null' for tests skipped due to dependency failure and therefore it is not possible to expect it in the test event.
Codecov Report
@@ Coverage Diff @@
## oapi #725 +/- ##
==========================================
+ Coverage 78.88% 79.02% +0.14%
==========================================
Files 191 191
Lines 26749 26757 +8
==========================================
+ Hits 21102 21146 +44
+ Misses 5647 5611 -36
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
agent/php_execute.c
Outdated
@@ -491,8 +491,8 @@ static nr_library_table_t libraries[] = { | |||
* /usr/local/bin. While BaseTestRunner isn't the very first file to load, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the comment be updated since we don't use BaseTestRunner anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Comment updated in bd240c9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this.
Remove a reference to a file no longer used to detect PHPUnit framework.
improve phpunit detection
Use file that is loaded also on PHP 8.2 with include/require optimizations that
don't execute files without executable statements.
improve skipped tests handling
PHPUnit passes skipped tests to
addError
as well asendTest
regardless ofthe version. The difference is that in PHPUnit 5.x it is not possible to obtain
test outcome for skipped test -
$test.getStatus()
returns 'null'. Because ofthat,
endTest
instrumentation bails out and does not generate test event andtherefore
addError
needs to be instrumented. It is possible to obtain testoutcome for skipped tests in PHPUnit 9.x. However, the
$time
for skipped testis not received in
endTest
as a valid double and therefore it needs to be'fixed'. Moreover testcase.getStatusMessage returns 'null' for tests skipped due
to dependency failure and therefore it is not possible to expect it in the test
event.