コード例 #1
0
ファイル: UnitTest.php プロジェクト: JJVV27/FantasyDataAPI
 /**
  * Set up our test fixture.
  *
  * Expect a service URL something like this:
  *   http://api.nfldata.apiphany.com/developer/xml/AreAnyGamesInProgress/?key=000aaaa0-a00a-0000-0a0a-aa0a00000000
  */
 public static function setUpBeforeClass()
 {
     static::$sClient = new MockClient($_SERVER['FANTASY_DATA_API_KEY'], Subscription::KEY_DEVELOPER);
     /** \GuzzleHttp\Command\Model */
     static::$sClient->AreAnyGamesInProgress([]);
     static::$sResponse = static::$sClient->mHistory->getLastResponse();
     static::$sEffectiveUrl = static::$sResponse->getEffectiveUrl();
     static::$sUrlFragments = explode('/', static::$sEffectiveUrl);
 }
コード例 #2
0
ファイル: UnitTest.php プロジェクト: JJVV27/FantasyDataAPI
 /**
  * Set up our test fixture.
  *
  * Expect a service URL something like this:
  *   http://api.nfldata.apiphany.com/developer/json/ScoresByWeek/2013REG/17?key=000aaaa0-a00a-0000-0a0a-aa0a00000000
  */
 public static function setUpBeforeClass()
 {
     static::$sClient = new MockClient($_SERVER['FANTASY_DATA_API_KEY'], Subscription::KEY_DEVELOPER);
     /** \GuzzleHttp\Command\Model */
     static::$sClient->ScoresByWeek(['Season' => '2013REG', 'Week' => 17]);
     static::$sResponse = static::$sClient->mHistory->getLastResponse();
     static::$sEffectiveUrl = static::$sResponse->getEffectiveUrl();
     static::$sUrlFragments = explode('/', static::$sEffectiveUrl);
 }
コード例 #3
0
ファイル: UnitTest.php プロジェクト: JJVV27/FantasyDataAPI
 /**
  * Set up our test fixture.
  *
  * Expect a service URL something like this:
  *   http://api.nfldata.apiphany.com/developer/json/SeasonLeagueLeaders/2013REG/NE?key=000aaaa0-a00a-0000-0a0a-aa0a00000000
  */
 public static function setUpBeforeClass()
 {
     static::$sClient = new MockClient($_SERVER['FANTASY_DATA_API_KEY'], Subscription::KEY_DEVELOPER);
     /** \GuzzleHttp\Command\Model */
     static::$sClient->SeasonLeagueLeaders(['Season' => '2013REG', 'Position' => 'WR', 'Column' => 'FantasyPoints']);
     static::$sResponse = static::$sClient->mHistory->getLastResponse();
     static::$sEffectiveUrl = static::$sResponse->getEffectiveUrl();
     static::$sUrlFragments = explode('/', static::$sEffectiveUrl);
 }
コード例 #4
0
ファイル: UnitTest.php プロジェクト: JJVV27/FantasyDataAPI
 /**
  * Given: A developer API key
  * When: API is queried for Teams without Season
  * Then: Expect that active teams are returned
  *
  * @group Unit
  * @small
  */
 public function testMakeSureSeasonIsntRequired()
 {
     $client = new MockClient($_SERVER['FANTASY_DATA_API_KEY'], Subscription::KEY_DEVELOPER);
     /** \GuzzleHttp\Command\Model */
     $client->Teams(['Season' => '2014']);
     $response = $client->mHistory->getLastResponse();
     $this->assertEquals('200', $response->getStatusCode());
     $client = NULL;
     $response = NULL;
 }
コード例 #5
0
ファイル: UnitTest.php プロジェクト: JJVV27/FantasyDataAPI
 /**
  * Given: A developer API key
  * When: API is queried for 2013REG Injuries, Week 17, NE (optional team parameter)
  * Then: Expect that the Team is placed in the URI
  *
  * @group Unit
  * @small
  */
 public function testTeamInURI()
 {
     /** this resource has alternate options, so not using the class setup to test them */
     $client = new MockClient($_SERVER['FANTASY_DATA_API_KEY'], Subscription::KEY_DEVELOPER);
     /** \GuzzleHttp\Command\Model */
     $client->Injuries(['Season' => '2013REG', 'Week' => '17', 'Team' => 'NE']);
     $response = $client->mHistory->getLastResponse();
     $effective_url = $response->getEffectiveUrl();
     $url_fragments = explode('/', $effective_url);
     /** key 8 should be the Week based on URL structure */
     $this->assertArrayHasKey(8, $url_fragments);
     list($team) = explode('?', $url_fragments[8]);
     $this->assertEquals($team, 'NE');
     $client = NULL;
     $response = NULL;
     $effective_url = NULL;
     $url_fragments = NULL;
 }