-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3.0' of github.com:dystcz/laravel-fakturoid into 3.0
- Loading branch information
Showing
7 changed files
with
142 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
use Dystcz\Fakturoid\Contracts\Fakturoid as FakturoidContract; | ||
use Dystcz\Fakturoid\Facades\Fakturoid as FakturoidFacade; | ||
use Dystcz\Fakturoid\Fakturoid; | ||
use Dystcz\Fakturoid\Tests\TestCase; | ||
use Fakturoid\Auth\CredentialCallback; | ||
use Fakturoid\Auth\Credentials; | ||
use Fakturoid\Enum\AuthTypeEnum; | ||
use Fakturoid\FakturoidManager; | ||
|
||
uses(TestCase::class); | ||
|
||
it('forwards calls to FakturoidManager', function (string $method, array $params = []) { | ||
/** @var TestCase $this */ | ||
$fakturoidManager = Mockery::mock(FakturoidManager::class); | ||
|
||
$this->app->instance('fakturoid', $fakturoidManager); | ||
|
||
$fakturoid = Mockery::mock(Fakturoid::class, FakturoidContract::class); | ||
|
||
$fakturoidManager->shouldReceive('authClientCredentials')->once(); | ||
$fakturoidManager->shouldReceive($method)->once()->with(...$params); | ||
|
||
FakturoidFacade::{$method}(...$params); | ||
})->with([ | ||
['setAccountSlug', ['test']], | ||
['getAuthProvider'], | ||
['getAuthenticationUrl'], | ||
['requestCredentials', ['code']], | ||
['getCredentials'], | ||
['setCredentials', [new Credentials( | ||
'refresh_token', | ||
'access_token', | ||
DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM, '2021-01-01T00:00:00+00:00'), | ||
AuthTypeEnum::AUTHORIZATION_CODE_FLOW | ||
)]], | ||
['setCredentialsCallback', [ | ||
new class implements CredentialCallback | ||
{ | ||
public function __invoke(?Credentials $credentials = null): void {} | ||
}, | ||
]], | ||
['authClientCredentials'], | ||
['getDispatcher'], | ||
['getAccountProvider'], | ||
['getBankAccountsProvider'], | ||
['getEventsProvider'], | ||
['getExpensesProvider'], | ||
['getGeneratorsProvider'], | ||
['getInboxFilesProvider'], | ||
['getInventoryItemsProvider'], | ||
['getInventoryMovesProvider'], | ||
['getInvoicesProvider'], | ||
['getNumberFormatsProvider'], | ||
['getRecurringGeneratorsProvider'], | ||
['getSubjectsProvider'], | ||
['getTodosProvider'], | ||
['getUsersProvider'], | ||
['getWebhooksProvider'], | ||
]); |