<?php
declare(strict_types=1);
namespace tests;
use app\Request;
/**
* @mixin BaseTest
**/
trait HttpRun
{
public function jsonPost(string $controller,string $action,array $data){
$request = new Request();
$request->setPathinfo('/'.$controller.'/'.$action);
$request->withHeader(['HTTP_ACCEPT' => 'application/json',]);
$request->withServer(['REQUEST_METHOD'=>'POST']);
$request->withPost($data);
$response = $this->app->http->run($request);
$response->send();
$this->app->http->end($response);
return $response->getContent()
}
}