当前位置: 首页>>代码示例>>PHP>>正文


PHP Api::setKey方法代码示例

本文整理汇总了PHP中Api::setKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::setKey方法的具体用法?PHP Api::setKey怎么用?PHP Api::setKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api::setKey方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFresh

 public function testFresh()
 {
     $api1 = Api::setKey('key');
     Api::fresh();
     $api2 = Api::setKey('key');
     $this->assertNotEquals(spl_object_hash($api1), spl_object_hash($api2));
 }
开发者ID:Innovacionlechuga,项目名称:leaguewrap,代码行数:7,代码来源:StaticApiTest.php

示例2: testLeague

 public function testLeague()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('v2.5/league/by-summoner/272354', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/league.272354.json'));
     Api::setKey('key', $this->client);
     $leagues = League::league(272354);
     $this->assertTrue($leagues[0] instanceof LeagueWrap\Dto\League);
 }
开发者ID:paquettg,项目名称:leaguewrap,代码行数:8,代码来源:StaticLeagueTest.php

示例3: testFree

 public function testFree()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('v1.2/champion', ['freeToPlay' => 'true', 'api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/champion.free.json'));
     Api::setKey('key', $this->client);
     $free = Champion::free();
     $this->assertEquals(10, count($free->champions));
 }
开发者ID:paquettg,项目名称:leaguewrap,代码行数:8,代码来源:StaticChampionTest.php

示例4: testRanked

 public function testRanked()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('na/v1.3/stats/by-summoner/74602/ranked', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/stats.ranked.74602.season4.json'));
     Api::setKey('key', $this->client);
     $stats = Stats::ranked(74602);
     $this->assertTrue($stats->champion(0) instanceof LeagueWrap\Dto\ChampionStats);
 }
开发者ID:Innovacionlechuga,项目名称:leaguewrap,代码行数:8,代码来源:StaticStatsTest.php

示例5: testStaticItem

 public function testStaticItem()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('na/v1.2/item', ['api_key' => 'key', 'locale' => 'ko_KR'])->once()->andReturn(file_get_contents('tests/Json/Static/items.kr.json'));
     Api::setKey('key', $this->client);
     $items = StaticData::setLocale('ko_KR')->getItems();
     $item = $items->getItem(1042);
     $this->assertEquals('단검', $item->name);
 }
开发者ID:Innovacionlechuga,项目名称:leaguewrap,代码行数:9,代码来源:StaticStaticDataTest.php

示例6: testMasteriesSummonerArray

 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));
 }
开发者ID:Innovacionlechuga,项目名称:leaguewrap,代码行数:10,代码来源:StaticSummonerTest.php

示例7: testRecentSummoner

 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);
 }
开发者ID:Innovacionlechuga,项目名称:leaguewrap,代码行数:10,代码来源:StaticGameTest.php

示例8: testSingleLimitStaticProxy

 /**
  * @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');
 }
开发者ID:paquettg,项目名称:leaguewrap,代码行数:17,代码来源:LimitTest.php

示例9: testRememberSummonerStaticProxy

 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());
 }
开发者ID:Graves-,项目名称:leaguewrap,代码行数:15,代码来源:CacheTest.php

示例10: testTeamListMaxException

 /**
  * @expectedException LeagueWrap\Exception\ListMaxException
  */
 public function testTeamListMaxException()
 {
     Api::setKey('key', $this->client);
     Team::team([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
 }
开发者ID:paquettg,项目名称:leaguewrap,代码行数:8,代码来源:StaticTeamTest.php

示例11: testNoCaching5xxError

 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());
 }
开发者ID:Innovacionlechuga,项目名称:leaguewrap,代码行数:20,代码来源:CacheTest.php


注:本文中的Api::setKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。