public function testChampionByIdWithStaticImport() { $this->client->shouldReceive('baseUrl')->twice(); $this->client->shouldReceive('request')->with('na/v1.2/champion/10', ['api_key' => 'key'])->twice()->andReturn(file_get_contents('tests/Json/champion.10.json'), file_get_contents('tests/Json/Static/champion.10.json')); $api = new Api('key', $this->client); $kayle = $api->attachStaticData()->champion()->championById(10); $this->assertEquals('Kayle', $kayle->championStaticData->name); }
public function testMatchWithStatic() { $this->client->shouldReceive('baseUrl')->times(4); $this->client->shouldReceive('request')->with('na/v2.2/match/1399898747', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/matchhistory.match.1399898747.json')); $this->client->shouldReceive('request')->with('na/v1.2/champion', ['api_key' => 'key', 'dataById' => 'true'])->once()->andReturn(file_get_contents('tests/Json/Static/champion.json')); $this->client->shouldReceive('request')->with('na/v1.2/summoner-spell', ['api_key' => 'key', 'dataById' => 'true'])->once()->andReturn(file_get_contents('tests/Json/Static/summonerspell.json')); $this->client->shouldReceive('request')->with('na/v1.2/item', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/Static/items.json')); $api = new Api('key', $this->client); $api->attachStaticData(); $match = $api->match()->match(1399898747); $this->assertEquals('LeBlanc', $match->team(0)->ban(0)->championStaticData->name); }
public function testAttachStaticData() { $this->client->shouldReceive('baseUrl')->with('https://euw.api.pvp.net/observer-mode/rest/consumer/getSpectatorGameInfo/EUW1/')->once(); $this->client->shouldReceive('baseUrl')->with('https://global.api.pvp.net/api/lol/static-data/')->times(4); $this->client->shouldReceive('request')->with('30447079', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/currentgame.30447079.json')); $this->client->shouldReceive('request')->with('v1.2/champion', ['api_key' => 'key', 'dataById' => 'true'])->once()->andReturn(file_get_contents('tests/Json/Static/champion.euw.json')); $this->client->shouldReceive('request')->with('v1.2/summoner-spell', ['api_key' => 'key', 'dataById' => 'true'])->once()->andReturn(file_get_contents('tests/Json/Static/summonerspell.euw.json')); $this->client->shouldReceive('request')->with('v1.2/mastery', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/Static/mastery.euw.json')); $this->client->shouldReceive('request')->with('v1.2/rune', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/Static/rune.euw.json')); $api = new Api('key', $this->client); $api->setRegion('euw'); $api->attachStaticData(true); $game = $api->currentGame()->currentGame(30447079); $participant = $game->participant(28882300); $rune = $participant->rune(5253); $this->assertTrue($rune->runeStaticData instanceof LeagueWrap\Dto\StaticData\Rune); $masteries = $participant->masteries; $this->assertTrue($masteries[6111]->masteryStaticData instanceof LeagueWrap\Dto\StaticData\Mastery); }