Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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']);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 6
0
 public function testSummoner()
 {
     $api = new Api('key');
     $summoner = $api->summoner();
     $this->assertTrue($summoner instanceof LeagueWrap\Api\Summoner);
 }
Ejemplo n.º 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;
Ejemplo n.º 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);
 }
Ejemplo n.º 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');
 }