| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function takeScreenShotAfterFailedStep(AfterStepScope $scope) |
||
| 15 | { |
||
| 16 | if ($scope->getTestResult()->getResultCode() !== TestResult::FAILED) { |
||
| 17 | return; |
||
| 18 | } |
||
| 19 | |||
| 20 | $driver = $this->getSession()->getDriver(); |
||
| 21 | |||
| 22 | if (!($driver instanceof Selenium2Driver)) { |
||
| 23 | return; |
||
| 24 | } |
||
| 25 | |||
| 26 | $fileName = basename($scope->getFeature()->getFile()) . '_' . $scope->getStep()->getLine(); |
||
| 27 | file_put_contents($this->getScreenShotDir() . $fileName . '.png', $this->getSession()->getDriver()->getScreenshot()); |
||
| 28 | } |
||
| 29 | |||
| 38 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.