Ejemplo n.º 1
0
 public function testInfo()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('v1.2/champion', ['freeToPlay' => 'false', 'api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/champion.json'));
     Api::setKey('key', $this->client);
     $champions = Champion::all();
     $this->assertTrue($champions->getChampion(55) instanceof LeagueWrap\Dto\Champion);
 }
Ejemplo n.º 2
0
  *       "name": "Champion",
  *       "slug": "champ",
  *       "games": 4,
  *       "wins": 2,
  *       "bans": 1
  *     },
  *	   {
  *       "name": "Champion",
  *       "slug": "champ",
  *       "games": 6,
  *       "wins": 3,
  *       "bans": 2
  *     }]
  */
 $this->get('', function ($req, $res, $args) {
     $champions = \Champion::all();
     if ($champions) {
         return $res->withStatus(200)->write($champions->toJson());
     } else {
         return $res->withStatus(400)->write($e->getMessage());
     }
 })->setName('champions');
 /**
  * @api {get} /champions/:id Get the champion with the provided id
  * @apiName GetChampion
  * @apiVersion 1.0.0
  * @apiSuccess {Object} champion Champion infos
  */
 $this->get('/{id}', function ($req, $res, $args) {
     $champion = \Champion::find($args['id']);
     if ($champion) {