Improve api operations

Change directory structure
Add bitinflow-accounts socialite provider
Improve docs generation
This commit is contained in:
René Preuß
2019-09-22 21:53:49 +02:00
parent 8a3d7e0411
commit 228c845bb5
32 changed files with 569 additions and 37 deletions

View File

@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace GhostZero\BitinflowAccounts\Tests\TestCases;
use GhostZero\BitinflowAccounts\BitinflowAccounts;
use GhostZero\BitinflowAccounts\Result;
/**
* @author René Preuß <rene@preuss.io>
*/
abstract class ApiTestCase extends TestCase
{
protected static $rateLimitRemaining = null;
protected function setUp(): void
{
parent::setUp();
if (!$this->getClientId()) {
$this->markTestSkipped('No Client-ID given');
}
if (self::$rateLimitRemaining !== null && self::$rateLimitRemaining < 3) {
$this->markTestSkipped('Rate Limit exceeded (' . self::$rateLimitRemaining . ')');
}
$this->getClient()->setClientId($this->getClientId());
}
protected function registerResult(Result $result): Result
{
self::$rateLimitRemaining = $result->rateLimit('remaining');
return $result;
}
protected function getClientId()
{
return getenv('CLIENT_ID');
}
protected function getClientSecret()
{
return getenv('CLIENT_KEY');
}
protected function getToken()
{
return getenv('CLIENT_ACCESS_TOKEN');
}
public function getClient(): BitinflowAccounts
{
return app(BitinflowAccounts::class);
}
}