public function testListSummoner()
 {
     $this->client->shouldReceive('baseUrl')->twice();
     $this->client->shouldReceive('request')->with('na/v2.2/matchlist/by-summoner/74602', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/matchlist.74602.json'));
     $this->client->shouldReceive('request')->with('na/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');
     $matchList = $api->matchlist()->matchlist($bakasan);
     $this->assertTrue($bakasan->matchlist->match(0) instanceof LeagueWrap\Dto\MatchReference);
 }
예제 #2
0
 public function testTeamSummonerMultiple()
 {
     $this->client->shouldReceive('baseUrl')->with('https://na.api.pvp.net/api/lol/na/')->twice();
     $this->client->shouldReceive('request')->with('v1.4/summoner/18991200,492066', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.18991200.492066.json'));
     $this->client->shouldReceive('request')->with('v2.4/team/by-summoner/492066,18991200', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/team.18991200.492066.json'));
     $api = new Api('key', $this->client);
     $summoners = $api->summoner()->info([18991200, 492066]);
     $api->team()->team($summoners);
     $team = $summoners['C9 Hai']->teams['TEAM-9baaf74e-ea61-4ebc-82d9-b013d29399fa'];
     $this->assertEquals('C9', $team->tag);
 }
예제 #3
0
 public function testChampionsAttachResponse()
 {
     $this->client->shouldReceive('baseUrl')->with('https://na.api.pvp.net/api/lol/na/')->once();
     $this->client->shouldReceive('baseUrl')->with('https://na.api.pvp.net/championmastery/location/NA1/')->once();
     $this->client->shouldReceive('request')->with('player/74602/champions', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/championmastery.30447079.topcount3.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');
     $api->championMastery()->champions($bakasan);
     $this->assertTrue($bakasan->championmastery instanceof \LeagueWrap\Dto\ChampionMasteryList);
 }
예제 #4
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']);
 }
예제 #5
0
 public function testSummonerySummonerSeason()
 {
     $this->client->shouldReceive('baseUrl')->with('https://na.api.pvp.net/api/lol/na/')->twice();
     $this->client->shouldReceive('request')->with('v1.3/stats/by-summoner/74602/summary', ['api_key' => 'key', 'season' => 3])->once()->andReturn(file_get_contents('tests/Json/stats.summary.74602.season4.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');
     $stats = $api->stats();
     $stats->setSeason(3);
     $stats->summary($bakasan);
     $this->assertTrue($bakasan->stats->playerStat(0) instanceof LeagueWrap\Dto\PlayerStatsSummary);
 }
예제 #6
0
 public function testSummoner()
 {
     $api = new Api('key');
     $summoner = $api->summoner();
     $this->assertTrue($summoner instanceof LeagueWrap\Api\Summoner);
 }
예제 #7
0
<?php

require 'vendor/autoload.php';
use LeagueWrap\Api;
$myKey = '59492bcc-6875-4422-81a5-57e2ca069696';
$api = new Api($myKey);
$summoner = $api->summoner();
$wins = 0;
$kills = 0;
$deaths = 0;
$assists = 0;
$dealt = 0;
$taken = 0;
$array = array("kills" => "0", "deaths" => "0", "assists" => "0", "dealt" => "0", "taken" => "0", "wins" => "0");
$data = $_GET['data'];
$summ = $summoner->info($data);
$id = $summ->id;
$matchHistory = $api->matchHistory();
$matches = $matchHistory->history($id);
foreach ($matches as $summary) {
    $temp2 = $summary->participants[0]->stats->kills;
    $kills = $kills + $temp2;
    $temp3 = $summary->participants[0]->stats->deaths;
    $deaths = $deaths + $temp3;
    $temp4 = $summary->participants[0]->stats->assists;
    $assists = $assists + $temp4;
    $temp5 = $summary->participants[0]->stats->totalDamageDealt;
    $dealt = $dealt + $temp5;
    $temp6 = $summary->participants[0]->stats->totalDamageTaken;
    $taken = $taken + $temp6;
    $temp1 = $summary->participants[0]->stats->winner;
예제 #8
0
 public function testEntrySummoners()
 {
     $this->client->shouldReceive('baseUrl')->twice();
     $this->client->shouldReceive('request')->with('na/v1.4/summoner/74602,272354,7024', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.74602.272354.7024.json'));
     $this->client->shouldReceive('request')->with('na/v2.5/league/by-summoner/272354,7024,74602/entry', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/league.74602.272354.7024.entry.json'));
     $api = new Api('key', $this->client);
     $summoners = $api->summoner()->info([74602, 272354, 7024]);
     $api->league()->league($summoners, true);
     $this->assertTrue($summoners['GamerXz']->leagues[0] instanceof LeagueWrap\Dto\League);
 }
예제 #9
0
 /**
  * @expectedException LeagueWrap\Response\Http404
  */
 public function testInfoSummonerNotFound()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('na/v1.4/summoner/by-name/bakasan', ['api_key' => 'key'])->once()->andReturn(new LeagueWrap\Response('', 404));
     $api = new Api('key', $this->client);
     $bakasan = $api->summoner()->info('bakasan');
 }