Skip to content

Commit

Permalink
support video.upload against api-video
Browse files Browse the repository at this point in the history
  • Loading branch information
arudolph committed Mar 22, 2011
1 parent a57756d commit 04168d5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/facebook.php
Expand Up @@ -141,10 +141,11 @@ class Facebook
* Maps aliases to Facebook domains.
*/
public static $DOMAIN_MAP = array(
'api' => 'https://api.facebook.com/',
'api_read' => 'https://api-read.facebook.com/',
'graph' => 'https://graph.facebook.com/',
'www' => 'https://www.facebook.com/',
'api' => 'https://api.facebook.com/',
'api_video' => 'https://api-video.facebook.com/',
'api_read' => 'https://api-read.facebook.com/',
'graph' => 'https://graph.facebook.com/',
'www' => 'https://www.facebook.com/',
);

/**
Expand Down Expand Up @@ -865,6 +866,8 @@ protected function getApiUrl($method) {
$name = 'api';
if (isset($READ_ONLY_CALLS[strtolower($method)])) {
$name = 'api_read';
} else if (strtolower($method) == 'video.upload') {
$name = 'api_video';
}
return self::getUrl($name, 'restserver.php');
}
Expand Down
23 changes: 23 additions & 0 deletions tests/tests.php
Expand Up @@ -754,6 +754,29 @@ public function testBundledCACert() {
$response['id'], '5526183', 'should get expected id.');
}

public function testVideoUpload() {
$facebook = new FBRecordURL(array(
'appId' => self::APP_ID,
'secret' => self::SECRET,
'cookie' => true,
));
$facebook->setSession(self::$VALID_EXPIRED_SESSION);
$facebook->api(array('method' => 'video.upload'));
$this->assertContains('//api-video.', $facebook->getRequestedURL(),
'video.upload should go against api-video');
}
}

class FBRecordURL extends Facebook {
private $url;

protected function _oauthRequest($url, $params) {
$this->url = $url;
}

public function getRequestedURL() {
return $this->url;
}
}

class FBPublic extends Facebook {
Expand Down

0 comments on commit 04168d5

Please sign in to comment.