テストされているコードがいくつかのerror_log
情報を出力するいくつかのテストがありました(失敗もテストしているので、これは予想されます)
例えば
<?php
Class X {
function dosomething(){
error_log('did it');
return true;
}
}
そしてテスト:
<?php
require_once 'X.php';
class xTest extends PHPUnit_Framework_TestCase {
public function testDo(){
$x = new X();
$this->assertTrue( $x->dosomething(), 'dosomething returns true');
}
}
なし で php_unit で実行すると--process-isolation
、私.
がテストしているものは何でもパスします。
ただし、実行すると --process-isolation
次のようになります。
1) test::a with data set #1 'a'
RuntimeException: did it
なぜそれが起こっているのですか?私はバージョン 3.4.12 で立ち往生しています (それについてはあまりできません) が、それについて変更ログに興味深いものは何も見つかりませんでした。
サンプルセッションは次のとおりです。
xxx$ phpunit xTest.php
PHPUnit 3.4.12 by Sebastian Bergmann.
did it
.
Time: 0 seconds, Memory: 4.50Mb
OK (1 test, 1 assertion)
shell return code: 0
xxx$ phpunit --process-isolation xTest.php
PHPUnit 3.4.12 by Sebastian Bergmann.
E
Time: 0 seconds, Memory: 4.50Mb
There was 1 error:
1) xTest::testDo
RuntimeException: did it
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
shell return code: 2
編集:「phpunit runtimeexception error_log」を検索していましたが、これを送信してから 5 秒後には、すでにトップの検索結果になっています :( そこには何もありません。
しかし、私は編集してこれを言うためにここに来ました: 追加$this->setExpectedException('RuntimeException');
してもこれをキャッチすることはまったくありません. 同じ結果が起こります。