Phpunit - printing results with PHPUnit_TextUI_ResultPrinter? -
i have situation calling phpunit_textui_testrunner directly
try { error_log('phpunit'); $phpunit = new phpunit_textui_testrunner(); $test_results = $phpunit->dorun($phpunit->gettest(__dir__.'/../tests', '', 'test.php')); error_log($test_results->count().' '.$test_results->failurecount()); } catch (phpunit_framework_exception $e) { print $e->getmessage() . "\n"; error_log("unit tests failed."); } as per answer in thread can run phpunit tests script?
in case, i'd see number , details if tests ran, , display them user. i've updated code set printer object
try { error_log('phpunit'); $phpunit = new phpunit_textui_testrunner(); // set printer $resultprinter = new phpunit_textui_resultprinter(); $phpunit->setprinter($resultprinter); $test_results = $phpunit->dorun($phpunit->gettest(__dir__.'/../tests', '', 'test.php')); error_log($test_results->count().' '.$test_results->failurecount()); // print results returns nothing? $resultprinter->printresult($test_results); $resultprinter->flush(); } catch (phpunit_framework_exception $e) { print $e->getmessage() . "\n"; error_log("unit tests failed."); } but nothing appears in log. can advise how can capture , display output phpunit_textui_resultprinter?
Comments
Post a Comment