php - why error_log generate a RuntimeException only with phpunit's --process-isolation -
i had few tests code being tested outputed error_log information (since i'm testing failures well, expected)
e.g.
<?php class x { function dosomething(){ error_log('did it'); return true; } } and test:
<?php require_once 'x.php'; class xtest extends phpunit_framework_testcase { public function testdo(){ $x = new x(); $this->asserttrue( $x->dosomething(), 'dosomething returns true'); } } which when run on php_unit without --process-isolation gives me nice . , whatever i'm testing pass.
however, when run with --process-isolation get:
1) test::a data set #1 'a' runtimeexception: did why happening? i'm stuck on version 3.4.12 (can't it) didn't find interesting in changelog that.
here's sample session:
xxx$ phpunit xtest.php phpunit 3.4.12 sebastian bergmann. did . 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 sebastian bergmann. e time: 0 seconds, memory: 4.50mb there 1 error: 1) xtest::testdo runtimeexception: did failures! tests: 1, assertions: 0, errors: 1. shell return code: 2 edit: searching "phpunit runtimeexception error_log" , 5sec after submiting it's top search result :( there's nothing out there.
but came here edit , this: adding $this->setexpectedexception('runtimeexception'); absolutely nothing catch this. same outcome happens.
my guess there difference between error_log configuration in outer , inner process. default when running error_log() cli written stderr , cause test failure. need work out why there difference. guess have code runs in outer process changes configuration not getting run on inner.
Comments
Post a Comment