/** * Get client videos. This will be paged. * * @return type */ public function getVideos() { $api = '/videos'; //Set the request URL to clients API. $this->request->setURL($this->BASE_URI . $api); //Get API results $response = $this->HTTP->Get(); return new Pager($response); }
/** * Test the CurlRequest object. */ public function testCurlRequestObject() { //GET CurlRequest $CurlRequestGET = new MediaManager\HTTP\CurlRequest('http://www.example.com', 'GET'); //Assert URL is returned correctly. $this->assertEquals('http://www.example.com', $CurlRequestGET->getURL()); //Set the request data $CurlRequestGET->setData(['fo' => 'bar']); $this->assertEquals(['fo' => 'bar'], $CurlRequestGET->getData()); //Set sending file $CurlRequestGET->sendFile(true); $this->assertEquals(true, $CurlRequestGET->isSendingFile()); //Set the headers $CurlRequestGET->setHeaders(['Content-Type: application/json']); $this->assertEquals(['Content-Type: application/json'], $CurlRequestGET->getHeaders()); //Check type is still GET. $this->assertEquals('GET', $CurlRequestGET->getType()); //Update the request type to POST. $CurlRequestGET->setType('POST'); //Assert true. $this->assertEquals('POST', $CurlRequestGET->getType()); //New BasicAuth object. $basicAuth = new MediaManager\HTTP\BasicAuth('foo', 'bar'); //Set the basic auth. $CurlRequestGET->setAuth($basicAuth); //Check BasicAuth is returned $this->assertInstanceOf("MediaManager\\HTTP\\BasicAuth", $CurlRequestGET->getBasicAuth()); }