Created
September 3, 2013 11:08
-
-
Save serapheem/6422505 to your computer and use it in GitHub Desktop.
PHPUnit - Failed test listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ClipKit\Test; | |
/** | |
* Base class for the selenium tests | |
* | |
* @author Serhiy Hlushko <s.hlushko@gmail.com> | |
*/ | |
abstract class WebTestCase extends \PHPUnit_Framework_TestCase | |
{ | |
public function onNotSuccessfulTest(\Exception $e) | |
{ | |
if ($e instanceof \PHPUnit_Framework_ExpectationFailedException | |
&& getenv('SELENIUM_SCREENSHOT_CAPTURE') | |
) { | |
if ($fileUrl = $this->saveCurrentScreenshot()) { | |
echo PHP_EOL . PHP_EOL . 'ScreenshotUrl: ' . $fileUrl; | |
} | |
} | |
parent::onNotSuccessfulTest($e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment