public function testAuthenticate2() { /** @var Request $request */ $request = MockRequestFactory::create('/authenticate', 'POST', [], [], [], [], json_encode(['email' => '*****@*****.**', 'password' => 'hive'])); $request->headers()['content-type'] = 'application/json'; $response = new Response(); $this->hive->api($request, $response, false); $data = json_decode($response->body(), true); $this->assertEquals(200, $response->code()); $this->assertNotEmpty($data); $this->assertNotEmpty($data['token']); $request->headers()['content-type'] = 'application/json'; $request->headers()['authorization'] = 'Bearer ' . $data['token']; $this->hive = Hive::create(); $response = new Response(); $this->hive->api($request, $response, false); $data = json_decode($response->body(), true); $this->assertEquals(200, $response->code()); $this->assertNotEmpty($data); $this->assertNotEmpty($data['token']); }