Exemplo n.º 1
0
 public function testAllRegionsLimit()
 {
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'br')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'eune')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'euw')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'kr')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'lan')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'las')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'na')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'oce')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'ru')->andReturn(true);
     $this->limit1->shouldReceive('setRate')->once()->with(10, 5, 'tr')->andReturn(true);
     $this->limit1->shouldReceive('hit')->once()->with(1)->andReturn(true);
     $this->limit1->shouldReceive('isValid')->once()->andReturn(true);
     $this->limit1->shouldReceive('getRegion')->times(10)->andReturn('br', 'eune', 'euw', 'kr', 'lan', 'las', 'na', 'oce', 'ru', 'tr');
     $this->limit1->shouldReceive('newInstance')->times(10)->andReturn($this->limit1);
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('v1.2/champion', ['freeToPlay' => 'true', 'api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/champion.free.json'));
     $api = new LeagueWrap\Api('key', $this->client);
     $api->limit(10, 5, 'all', $this->limit1);
     $champion = $api->champion();
     $info = $champion->free();
     $this->assertTrue(is_array($info->champions));
 }