I have slim php framework code but modified by a middleware that uses a php package as its service/controller but i have a problem beign able to send Authorization headers from php unit tests to the code itself the headers are not present when I print $_SERVER Array ... I cant retrieve the Headers from code ..
$param1 = "param1";
$param2 = "param2";
$param3 = "param3";
$env = Environment::mock(array(
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/v1/url/to/api',
'CONTENT_TYPE' => 'application/json',
'HTTP_AUTHORIZATION' => 'Bearer ' . $this->token,
));
$attributes = [
$param1 => "100",
$param2 => "0",
$param3 => "1000",
];
$req = Request::createFromEnvironment($env)->withParsedBody($attributes);
$this->app->getContainer()['request'] = $req;
$response = $this->app->run(true);
$this->assertSame($response->getStatusCode(), 200);
$result = json_decode($response->getBody(), true);
$this->assertIsArray($result["content"]);