示例#1
0
 protected function setUp()
 {
     // Get platform from class name
     $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1);
     $platform = substr($class, 0, strpos($class, 'ParserTest'));
     // Load sample responses
     $resourceLoader = new ResourceLoader($platform);
     $this->sampleResponses = $resourceLoader->loadSampleResponses();
 }
 /**
  * {@inheritdoc}
  */
 public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     // Load sample responses
     $resourceLoader = new ResourceLoader('Twitter');
     $this->sampleResponses = $resourceLoader->loadSampleResponses();
     // Return response
     if (strpos($path, 'account/verify_credentials') !== false) {
         return $this->sampleResponses['get-account-verify_credentials.json'];
     } elseif (strpos($path, 'search/tweets') !== false) {
         return $this->sampleResponses['get-search-tweets.json'];
     } elseif (strpos($path, 'statuses/show/') !== false) {
         return $this->sampleResponses['get-statuses-show-id.json'];
     } else {
         return '{}';
     }
 }
 /**
  * {@inheritdoc}
  */
 public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     // Load sample responses
     $resourceLoader = new ResourceLoader('Instagram');
     $this->sampleResponses = $resourceLoader->loadSampleResponses();
     // Return response
     if (strpos($path, 'users/self') !== false) {
         return $this->sampleResponses['get-users-self.json'];
     } elseif (strpos($path, 'media/search') !== false) {
         return $this->sampleResponses['get-media-search.json'];
     } elseif (strpos($path, 'tags/') !== false) {
         return $this->sampleResponses['get-tags-tag_name-media-recent.json'];
     } elseif (strpos($path, 'media/') !== false) {
         return $this->sampleResponses['get-media-media_id.json'];
     } else {
         return '{}';
     }
 }