Skip to content
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

Proposed solution for #5457 gherkin scenarios not loaded from group file #5458

Merged
merged 4 commits into from Apr 5, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Codeception/Lib/GroupManager.php
Expand Up @@ -118,6 +118,13 @@ public function groupsForTest(\PHPUnit\Framework\Test $test)
if (strpos($filename . ':' . $test->getName(false), $testPattern) === 0) {
$groups[] = $group;
}
// TODO: consider mb_strtolower per https://stackoverflow.com/a/5473569
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where metadata() method does not exist ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some tests it did not so I added the check to make sure it was there before I called it

if (
mozillalives marked this conversation as resolved.
Show resolved Hide resolved
method_exists($test, 'getMetadata')
&& strcasecmp($filename . ':' . $test->getMetadata()->getFeature(), $testPattern) === 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be UFT-8 compliant as put in your TODO
strcasecmp($filename . ':' . $test->getMetadata()->getFeature(), $testPattern) === 0to be replaced by mb_strtolower($filename . ':' . $test->getMetadata()->getFeature()) === mb_strtolower($testPattern)

Copy link
Contributor

@edno edno Apr 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since current solution is focused on Gherkin feature, before using $test->getMetadata()->getFeature(), you should verify that the current $test object is a Gherkin Test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that. Are there any other types of tests that might benefit from this comparison though?

) {
$groups[] = $group;
}
if ($test instanceof \PHPUnit\Framework\TestSuite\DataProvider) {
$firstTest = $test->testAt(0);
if ($firstTest != false && $firstTest instanceof TestInterface) {
Expand Down