jhedstrom / drupalextension

An integration layer between Behat, Mink Extension, and Drupal.
GNU General Public License v2.0
209 stars 192 forks source link

Cannot filter features by line number #487

Open jhedstrom opened 6 years ago

jhedstrom commented 6 years ago

Due to the way Drupal\DrupalExtension\Context\Environment\Reader::findSubContextClasses() is currently working, filtering a feature file by line number is broken.

vendor/bin/behat  --profile=drupal8 features/d8.feature:7
No scenarios
No steps
4m55.46s (20.82Mb)

In ExerciseController.php line 111:

  No specifications found at path(s) `features/d8.feature:7`. This might be because of incorrect paths configuration in your `suites`.

This is because when it loads each driver, if it implements SubDriverFinderInterface, then the getSubDriverPaths() method is called, which in turn bootstraps Drupal, and that changes the current working directory to Drupal. Thus, relative paths like features/d8.feature result in a file not found issue in Behat's PathsFilter::isFeatureMatch() when realpath($feature->getFile()) returns false.

jonathanjfshaw commented 6 years ago

I can't get vendor/bin/behat features/d8.feature to work even without specifying a line number. Whatever I try I get that error.