<?php require __DIR__ . '/bootstrap.php'; use Doctrine\Common\Cache\ArrayCache; use Fabricius\Loader\GithubLoader; use Guzzle\Http\Client; $client = new Client('https://api.github.com'); $provider = new GithubLoader($client, 'GITHUB OWNER', 'GITHUB REPO'); $provider->enableCurlAuthentication('GITHUB USERNAME', 'GITHUB PASSWORD'); $cache = new ArrayCache(); $library->registerRepository('Article', $provider, $cache); $content = $library->getRepository('Article')->query(); // Get the queried content as array... $content->toArray();
public function testAuthenticationThroughToken() { $client = Phake::mock('Guzzle\\Http\\Client'); $provider = new GithubLoader($client, 'GITHUB OWNER', 'GITHUB REPO'); $provider->enableTokenAuthentication('GITHUB TOKEN'); Phake::verify($client, Phake::times(1))->setDefaultOption('request.options/headers/Authorization', 'token GITHUB TOKEN'); }