mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 21:34:04 +00:00
Bring back ViteBundler
This commit is contained in:
parent
20996bfd47
commit
7a0fbc25a8
3 changed files with 61 additions and 0 deletions
|
|
@ -286,6 +286,7 @@ return [
|
||||||
// Stancl\Tenancy\Features\TelescopeTags::class,
|
// Stancl\Tenancy\Features\TelescopeTags::class,
|
||||||
// Stancl\Tenancy\Features\TenantConfig::class, // https://tenancyforlaravel.com/docs/v3/features/tenant-config
|
// Stancl\Tenancy\Features\TenantConfig::class, // https://tenancyforlaravel.com/docs/v3/features/tenant-config
|
||||||
// Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancyforlaravel.com/docs/v3/features/cross-domain-redirect
|
// Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancyforlaravel.com/docs/v3/features/cross-domain-redirect
|
||||||
|
// Stancl\Tenancy\Features\ViteBundler::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
26
src/Features/ViteBundler.php
Normal file
26
src/Features/ViteBundler.php
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Stancl\Tenancy\Features;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use Stancl\Tenancy\Contracts\Feature;
|
||||||
|
use Stancl\Tenancy\Tenancy;
|
||||||
|
use Stancl\Tenancy\Vite;
|
||||||
|
|
||||||
|
class ViteBundler implements Feature
|
||||||
|
{
|
||||||
|
/** @var Application */
|
||||||
|
protected $app;
|
||||||
|
|
||||||
|
public function __construct(Application $app)
|
||||||
|
{
|
||||||
|
$this->app = $app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bootstrap(Tenancy $tenancy): void
|
||||||
|
{
|
||||||
|
$this->app->singleton(\Illuminate\Foundation\Vite::class, Vite::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
tests/Features/ViteBundlerTest.php
Normal file
34
tests/Features/ViteBundlerTest.php
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Stancl\Tenancy\Features\ViteBundler;
|
||||||
|
use Stancl\Tenancy\Tests\Etc\Tenant;
|
||||||
|
use Stancl\Tenancy\Tests\TestCase;
|
||||||
|
use Stancl\Tenancy\Vite as StanclVite;
|
||||||
|
|
||||||
|
class ViteBundlerTest extends TestCase
|
||||||
|
{
|
||||||
|
/** @test */
|
||||||
|
public function the_vite_helper_uses_our_custom_class()
|
||||||
|
{
|
||||||
|
$vite = app(\Illuminate\Foundation\Vite::class);
|
||||||
|
|
||||||
|
$this->assertInstanceOf(\Illuminate\Foundation\Vite::class, $vite);
|
||||||
|
$this->assertNotInstanceOf(StanclVite::class, $vite);
|
||||||
|
|
||||||
|
config([
|
||||||
|
'tenancy.features' => [ViteBundler::class],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$tenant = Tenant::create();
|
||||||
|
|
||||||
|
tenancy()->initialize($tenant);
|
||||||
|
|
||||||
|
app()->forgetInstance(\Illuminate\Foundation\Vite::class);
|
||||||
|
|
||||||
|
$vite = app(\Illuminate\Foundation\Vite::class);
|
||||||
|
|
||||||
|
$this->assertInstanceOf(StanclVite::class, $vite);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue