SkippingUnsupportedTestCase.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Behat\Mink\Tests\Driver;
  3. use Behat\Mink\Exception\UnsupportedDriverActionException;
  4. if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) {
  5. /**
  6. * Implementation of the skipping for UnsupportedDriverActionException for PHPUnit 5+
  7. *
  8. * This code should be moved back to \Behat\Mink\Tests\Driver\TestCase when dropping support for
  9. * PHP 5.5 and older, as PHPUnit 4 won't be needed anymore.
  10. *
  11. * @internal
  12. */
  13. class SkippingUnsupportedTestCase extends \PHPUnit_Framework_TestCase
  14. {
  15. protected function onNotSuccessfulTest($e)
  16. {
  17. if ($e instanceof UnsupportedDriverActionException) {
  18. $this->markTestSkipped($e->getMessage());
  19. }
  20. parent::onNotSuccessfulTest($e);
  21. }
  22. }
  23. } else {
  24. /**
  25. * Implementation of the skipping for UnsupportedDriverActionException for PHPUnit 4
  26. *
  27. * @internal
  28. */
  29. class SkippingUnsupportedTestCase extends \PHPUnit_Framework_TestCase
  30. {
  31. protected function onNotSuccessfulTest(\Exception $e)
  32. {
  33. if ($e instanceof UnsupportedDriverActionException) {
  34. $this->markTestSkipped($e->getMessage());
  35. }
  36. parent::onNotSuccessfulTest($e);
  37. }
  38. }
  39. }