Example #1
0
<?php

require __DIR__ . '/bootstrap.php';
use Doctrine\Common\Cache\ArrayCache;
use Fabricius\Loader\DropboxLoader;
use Guzzle\Http\Client;
$client = new Client('https://api.dropbox.com/1');
$provider = new DropboxLoader($client, 'content');
$provider->enableOauthAuthentication('DROPBOX KEY', 'DROPBOX SECRET');
$cache = new ArrayCache();
$library->registerRepository('Article', $provider, $cache);
$content = $library->getRepository('Article')->query();
// Get the queried content as array...
$content->toArray();
 /**
  * @expectedException Fabricius\Exception\RuntimeException
  * @expectedExceptionMessage Request to Dropbox failed: An error occured [400]
  */
 public function testExceptionWhenAccessTokenFetchErrors()
 {
     $this->plugin->addResponse(new Response(400, null, json_encode(array('error' => 'An error occured'))));
     $provider = new DropboxLoader($this->client, 'DROPBOX FOLDER');
     $provider->enableOauthAuthentication('DROPBOX KEY', 'DROPBOX SECRET', null, 'DROPBOX CODE');
 }