1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 23:14:03 +00:00
tenancy/tests/Features/ViteBundlerTest.php
2022-09-28 17:17:21 +02:00

38 lines
1,007 B
PHP

<?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()
{
if (version_compare(app()->version(), '9.0', '<')) {
$this->markTestSkipped('Vite is only used in Laravel 9+');
}
$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);
}
}