@sectusの回答の修正版を使用することになりました:
public function onNotSuccessfulTest(Exception $e) {
$file_name = '/' . date('Y-m-d_H-i-s') . ' ' . $this->getName() . '.png';
file_put_contents($this->screenshotPath . $file_name, base64_decode($this->captureEntirePageScreenshotToString()));
parent::onNotSuccessfulTest($e);
}
条件付きチェックインは正常に機能しますが、 Extended phpunit error messagetearDown()
に基づいて、よりクリーンに見えたので使用することにしました。onNotSuccessfulTest()
ファイル名にコロン:
を使用できませんでした。そうしないと、次のエラー メッセージが表示されますfile_get_contents
。failed to open stream: Protocol error
関数currentScreenshot
も存在しなかったので、http://www.devinzuczek.com/2011/08/take-a-screenshot-with-phpunit-and-selenium-rc/に従って別の方法でスクリーンショットを撮ることになりました.