Welcome Guest, Not a member yet? Register   Sign In
ControllerTester double execution
#1

Hello,

if i execute the Code below, then the second execution always execute the created request of the first execution. Hence the second body are ignored.

Code:
$body = json_encode(['foo' => 'bar']);

$results = $this->withBody($body)
                ->controller(\App\Controllers\ForumController::class)
                ->execute('showCategories');


$body2 = json_encode(['bar' => 'foo']);

$results2 = $this->withBody($body2)
                ->controller(\App\Controllers\ForumController::class)
                ->execute('showCategories');

A workaround is:
Code:
$results2 = $this->withRequest(null)
                ->withBody($body2)
                ->controller(\App\Controllers\ForumController::class)
                ->execute('showCategories');
 to reset the Request. But i think that isn't meant to be.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB