-
Notifications
You must be signed in to change notification settings - Fork 1
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
Uses testdox prettifier for titles #5
base: master
Are you sure you want to change the base?
Conversation
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.
I'm glad the implementation is this simple.
Cons:
- Prettifies in a default testdox way also titles which are not annotated with a custom title. As a result, existing CW test suites also will be affected (note how the
testZeroIsEven
gets prettified despite of having no annotation).
I think this is fine. It looks pretty simple and shouldn't break anything.
The ::
in Even Or Odd Test::test Negative Even Numbers
looks weird, though.
@@ -97,6 +104,7 @@ public function startTestSuite(TestSuite $suite): void | |||
if (empty($suiteName)) { | |||
return; | |||
} | |||
$suiteName = $this->prettifier->prettifyTestClass($suiteName); |
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.
Is this correct? prettifyTestCase($test);
takes a TestCase
, but prettifyTestClass
takes a string?
Maybe this is causing the issue you mentioned?
- Titles of
<DESCRIBE::>
groups of tests generated with@dataProvider
seem to not respect the annotation (but this might be a bug of my implementation)
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.
At least that's how I read it in code of PHPUnit 9.6:
However, the bummer seems to be that PHPUnit 10 seems to change the prettifier: move it to another namespace, and rename the method to prettifyTestClassName(string $className)
. As a result, my reporter will break when PHPUnit gets updated :(
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.
The
::
inEven Or Odd Test::test Negative Even Numbers
looks weird, though.
I run the suite with original TestDox reporter and it seems that it avoids the weirdness by simply not showing the intermediate groups:
All test cases seem to be flattened, and test cases generated with @dataProvider
are not grouped under a common section, while CW reporter groups them with a <DESCRIBE::>
. The title is provided by TestDox prettifier, which apparently does not care much because it's not presented by the TestDox reporter anyway. This might also be a reason why "Titles of <DESCRIBE::>
groups of tests generated with @dataProvider
seem to not respect the annotation" - they do not respect the annotation, because these titles are not presented by the TestDox reporter.
Implements #4
Example kumite with result: here.
Pros:
@testdox
annotation on test classes, test methods, and generated tests.Cons:
testZeroIsEven
gets prettified despite of having no annotation).<DESCRIBE::>
groups of tests generated with@dataProvider
seem to not respect the annotation (but this might be a bug of my implementation)