예제 #1
0
 public function testRecentStatsSummonerRaw()
 {
     $this->client->shouldReceive('baseUrl')->with('https://na.api.pvp.net/api/lol/na/')->twice();
     $this->client->shouldReceive('request')->with('v1.3/game/by-summoner/74602/recent', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/game.recent.74602.json'));
     $this->client->shouldReceive('request')->with('v1.4/summoner/by-name/bakasan', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.bakasan.json'));
     $api = new Api('key', $this->client);
     $bakasan = $api->summoner()->info('bakasan');
     $games = $api->game()->recent($bakasan);
     $game = $bakasan->recentGame(0)->raw();
     $this->assertEquals(13, $game['stats']['level']);
 }
예제 #2
0
 public function testGame()
 {
     $api = new Api('key');
     $game = $api->game();
     $this->assertTrue($game instanceof LeagueWrap\Api\Game);
 }
예제 #3
0
<?php

require __DIR__ . '/vendor/autoload.php';
use LeagueWrap\Api;
$myKey = 'YOUR-DEVELOPER-RIOT-API-KEY';
$api = new Api($myKey);
$game = $api->game();
$games = $game->recent(74602);
$matchlistapi = $api->matchlist();
$matchlist = $matchlistapi->matchlist(74602);
$numberOfplayedGames = $matchlist->totalGames;
$roleInGame = $matchlist->match(0)->role;
print_r($matchlist);