私はPHP 5.3.6とGithubのPHPUnitの最新バージョンを実行しています。例17.1をドキュメントからコピーすると、assertTitleが失敗したときに致命的なエラーが発生します。PHPUnit、致命的なエラーでSelenium Basicテストが失敗する
Fatal error: Call to a member function toString() on a non-object in <path>/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumTestCase.php on line 1041
アサーションを変更すると、PHPUnitはうまく動作します。
私はラインを掘っ、これは抜粋です)
protected function onNotSuccessfulTest(Exception $e)
{
if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
$buffer = 'Current URL: ' . $this->drivers[0]->getLocation() .
"\n";
$message = $e->getComparisonFailure()->toString();
$ E-> getComparisonFailure(NULL、いないオブジェクトを返します。私は間違って何をしていますか?
UPDATE:修正はまだ私の地平線上にありませんが
私は、失敗の理由を発見しました。 PHPUnitの/フレームワーク/ Constraint.phpのライン92に
、それはのように定義される
$this->fail($other,$description)
使用呼び出し:NULL
は、何PHPUnit_Framework_ComparisonFailureが渡されないので
protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL)
をPHPUnit/Framework/Constraint.phpの141行目に渡されました
スロー新しいPHPUnit_Framework_ExpectationFailedException( $ failureDescription、 $ comparisonFailure)。
上記のように、オブジェクトを返すことになっているgetComparisonFailure()によってフェッチされます。
これ以上のアイデアはありませんか?
phpunit-seleniumのデフォルトのコピー貼り付けの例では、コピーと貼り付けが失敗する唯一のアサーションが失敗したときにバグがありますか? –