/** @test */ public function getUserFollowers() { $response = $this->createPaginatedResponse(); $this->mock->shouldReceive('exec')->once()->andReturn($response); $this->mock->shouldReceive('exec')->once()->andReturn(['resource_response' => ['data' => []]]); $this->mock->shouldReceive('exec')->once()->andReturn(['resource_response' => ['data' => [['type' => 'module']]]]); $followers = $this->provider->followers('username'); $this->assertCount(2, iterator_to_array($followers)[0]); $followers = $this->provider->followers('username'); $this->assertEmpty(iterator_to_array($followers)); }
public function testGetFollowers() { $response = $this->createPaginatedResponse(); $this->mock->expects($this->at(0))->method('exec')->willReturn($response); $this->mock->expects($this->at(1))->method('exec')->willReturn(['resource_response' => ['data' => []]]); $this->mock->expects($this->at(2))->method('exec')->willReturn(['resource_response' => ['data' => [['type' => 'module']]]]); $followers = $this->provider->followers('username'); $this->assertCount(2, iterator_to_array($followers)[0]); $followers = $this->provider->followers('username'); $this->assertEmpty(iterator_to_array($followers)); }
/** @test */ public function it_should_return_generator_with_user_followers() { $this->apiShouldReturnPagination()->apiShouldReturnEmpty(); $followers = $this->provider->followers('username'); $this->assertIsPaginatedResponse($followers); }