コード例 #1
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;
 }