/** * @test */ public function it_stores_the_token_pool_in_the_config() { $factory = new ClientFactory($this->getCacheMock()); $client = $factory->createClient($this->tenant); $pool = $client->getConfig('token_pool'); $this->assertInstanceOf(TokenPool::class, $pool); }
/** * @test * @expectedException \GuzzleHttp\Exception\ClientException */ public function it_fails_with_failed_reathentication() { $this->cache->set($this->getTokenKey(), $this->getTokenJson()); $client = $this->factory->createClient($this->tenant); Server::enqueue([new Response(403), new Response(401)]); try { $client->request('get', '/foo'); } catch (ClientException $e) { // original request should not have repeated $this->assertCount(2, Server::received()); throw $e; } }