init
This commit is contained in:
27 files changed
+1035
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Nova\Events\ServingNova;
|
||||
use Laravel\Nova\Nova;
|
||||
|
||||
beforeEach(function (): void {
|
||||
Nova::$scripts = [];
|
||||
Nova::$styles = [];
|
||||
});
|
||||
|
||||
it('registers its assets and localized configuration while serving Nova', function (): void {
|
||||
ServingNova::dispatch($this->app, request());
|
||||
|
||||
expect(Nova::allScripts())->toHaveCount(1)
|
||||
->and(Nova::allStyles())->toHaveCount(1)
|
||||
->and(Nova::jsonVariables(request())['novaMenuSearch'])->toMatchArray([
|
||||
'label' => 'Search main menu',
|
||||
'placeholder' => 'Search menu…',
|
||||
'noResults' => 'No menu items found.',
|
||||
'shortcut' => 'mod+k',
|
||||
'maxResults' => 10,
|
||||
]);
|
||||
});
|
||||
|
||||
it('does not register assets when menu search is disabled', function (): void {
|
||||
config()->set('nova-menu-search.enabled', false);
|
||||
|
||||
ServingNova::dispatch($this->app, request());
|
||||
|
||||
expect(Nova::allScripts())->toBeEmpty()
|
||||
->and(Nova::allStyles())->toBeEmpty();
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
use MeghdadFadaee\NovaMenuSearch\Tests\TestCase;
|
||||
|
||||
uses(TestCase::class)->in('Feature');
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MeghdadFadaee\NovaMenuSearch\Tests;
|
||||
|
||||
use Laravel\Nova\NovaCoreServiceProvider;
|
||||
use MeghdadFadaee\NovaMenuSearch\MenuSearchServiceProvider;
|
||||
use Orchestra\Testbench\TestCase as Orchestra;
|
||||
|
||||
abstract class TestCase extends Orchestra
|
||||
{
|
||||
/**
|
||||
* @return array<int, class-string>
|
||||
*/
|
||||
protected function getPackageProviders($app): array
|
||||
{
|
||||
return [
|
||||
NovaCoreServiceProvider::class,
|
||||
MenuSearchServiceProvider::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user