/** @test */ public function getLastResponseError() { $error = 'expected_error'; $mock = Mockery::mock(Response::class)->shouldReceive('getLastError')->andReturn($error)->getMock(); $request = new Request(new CurlAdapter()); $providersContainer = new ProvidersContainer($request, $mock); $bot = new Bot($providersContainer); $this->assertEquals($error, $bot->getLastError()); }
/** @test */ public function it_should_return_last_error_from_response() { $error = ['message' => 'expected_error']; $response = Mockery::mock(Response::class)->shouldReceive('getLastError')->andReturn($error)->getMock(); $request = new Request(new CurlHttpClient(new Cookies())); $providersContainer = new ProvidersContainer($request, $response); $bot = new Bot($providersContainer); $this->assertEquals($error['message'], $bot->getLastError()); }