init
This commit is contained in:
52 files changed
+5299
No files matched your search
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace MeghdadFadaee\NovaFormCard\Tests;
|
||||
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Orchestra\Testbench\TestCase as Orchestra;
|
||||
use MeghdadFadaee\NovaFormCard\FormCard;
|
||||
use MeghdadFadaee\NovaFormCard\FormCardServiceProvider;
|
||||
|
||||
abstract class TestCase extends Orchestra
|
||||
{
|
||||
protected function getPackageProviders($app): array
|
||||
{
|
||||
return [
|
||||
FormCardServiceProvider::class,
|
||||
];
|
||||
}
|
||||
|
||||
protected function defineEnvironment($app): void
|
||||
{
|
||||
$app['config']->set('app.key', 'base64:MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=');
|
||||
$app['config']->set('nova-form-card.token_ttl_minutes', 120);
|
||||
|
||||
$app['router']->aliasMiddleware('nova', SubstituteBindings::class);
|
||||
}
|
||||
|
||||
protected function novaRequest(string $method = 'GET', string $uri = '/nova'): NovaRequest
|
||||
{
|
||||
$request = NovaRequest::create($uri, $method);
|
||||
|
||||
$this->app->instance('request', $request);
|
||||
$this->app->instance(NovaRequest::class, $request);
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function serializeFormCard(FormCard $card): array
|
||||
{
|
||||
$this->novaRequest();
|
||||
|
||||
return $card->jsonSerialize();
|
||||
}
|
||||
|
||||
protected function tokenFor(FormCard $card): string
|
||||
{
|
||||
return (string) data_get($this->serializeFormCard($card), 'formCard.token');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user