コード例 #1
0
 public function testMasteriesSummonerArray()
 {
     $this->client->shouldReceive('baseUrl')->times(2);
     $this->client->shouldReceive('request')->with('na/v1.4/summoner/97235,7024/masteries', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.masteries.7024,97235.json'));
     $this->client->shouldReceive('request')->with('na/v1.4/summoner/7024,97235', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.7024,97235.json'));
     Api::setKey('key', $this->client);
     $summoners = Summoner::info([7024, 97235]);
     Summoner::masteryPages($summoners);
     $this->assertEquals(0, count($summoners['IS1c2d27157a9df3f5aef47']->masteryPages));
 }
コード例 #2
0
 public function testRecentSummoner()
 {
     $this->client->shouldReceive('baseUrl')->twice();
     $this->client->shouldReceive('request')->with('na/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('na/v1.4/summoner/by-name/bakasan', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.bakasan.json'));
     Api::setKey('key', $this->client);
     $bakasan = Summoner::info('bakasan');
     $games = Game::recent($bakasan);
     $this->assertTrue($bakasan->recentGame(0) instanceof LeagueWrap\Dto\Game);
 }
コード例 #3
0
ファイル: LimitTest.php プロジェクト: paquettg/leaguewrap
 /**
  * @expectedException LeagueWrap\Exception\LimitReachedException
  */
 public function testSingleLimitStaticProxy()
 {
     $this->limit1->shouldReceive('setRate')->once()->with(1, 10, 'na')->andReturn(true);
     $this->limit1->shouldReceive('hit')->twice()->with(1)->andReturn(true, false);
     $this->limit1->shouldReceive('isValid')->once()->andReturn(true);
     $this->limit1->shouldReceive('getRegion')->twice()->andReturn('na');
     $this->client->shouldReceive('baseUrl')->twice();
     $this->client->shouldReceive('request')->with('v1.4/summoner/by-name/bakasan', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/summoner.bakasan.json'));
     LeagueWrap\StaticApi::mount();
     Api::setKey('key', $this->client);
     Api::limit(1, 10, 'na', $this->limit1);
     Summoner::info('bakasan');
     Summoner::info('bakasan');
 }
コード例 #4
0
ファイル: CacheTest.php プロジェクト: rasmusrosengren/CAS
 public function testRememberSummonerStaticProxy()
 {
     $bakasan = file_get_contents('tests/Json/summoner.bakasan.json');
     $this->cache->shouldReceive('set')->once()->with($bakasan, '9bd8e5b11e0ac9c0a52d5711c9057dd2', 10)->andReturn(true);
     $this->cache->shouldReceive('has')->twice()->with('9bd8e5b11e0ac9c0a52d5711c9057dd2')->andReturn(false, true);
     $this->cache->shouldReceive('get')->once()->with('9bd8e5b11e0ac9c0a52d5711c9057dd2')->andReturn($bakasan);
     $this->client->shouldReceive('baseUrl')->twice();
     $this->client->shouldReceive('request')->with('na/v1.4/summoner/by-name/bakasan', ['api_key' => 'key'])->once()->andReturn($bakasan);
     LeagueWrap\StaticApi::mount();
     Api::setKey('key', $this->client);
     Api::remember(10, $this->cache);
     Summoner::info('bakasan');
     Summoner::info('bakasan');
     $this->assertEquals(1, Summoner::getRequestCount());
 }
コード例 #5
0
ファイル: Profile.php プロジェクト: quincy-soeliman/projectx
 public function __construct($summoner)
 {
     parent::__construct($summoner);
 }
コード例 #6
0
 public function testNoCaching5xxError()
 {
     $response = new LeagueWrap\Response('', 500);
     $exception = new LeagueWrap\Response\Http500('', 500);
     $this->cache->shouldReceive('has')->twice()->with('9bd8e5b11e0ac9c0a52d5711c9057dd2')->andReturn(false, false);
     $this->client->shouldReceive('baseUrl')->twice();
     $this->client->shouldReceive('request')->with('na/v1.4/summoner/by-name/bakasan', ['api_key' => 'key'])->twice()->andReturn($response);
     LeagueWrap\StaticApi::mount();
     Api::setKey('key', $this->client);
     Api::remember(10, $this->cache);
     try {
         Summoner::info('bakasan');
     } catch (LeagueWrap\Response\Http500 $e) {
     }
     try {
         Summoner::info('bakasan');
     } catch (LeagueWrap\Response\Http500 $e) {
     }
     $this->assertEquals(2, Summoner::getRequestCount());
 }