lundi 2 novembre 2015

Phpunit tests from code gives exception: Serialization of 'Closure' is not allowed - Laravel

I've got this code in my route (just to get it to work).

Route::get('/', function () {
$phpunit = new PHPUnit_TextUI_TestRunner;
try {
    $test_results = $phpunit->dorun($phpunit->getTest('/var/www/cms/tests/', '', 'Test.php'));
    echo '<pre>';
    var_dump($test_results);
    echo '</pre>';
    exit;
} catch (PHPUnit_Framework_Exception $e) {
    print $e->getMessage() . "\n";
    die ("Unit tests failed.");
}
});

The code example to run a test from code can be found here: Can you run PHPUnit tests from a script?

But when I run this I'm getting the error: Exception: Serialization of 'Closure' is not allowed

I can't figure out what is causing this error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire