fix(models): correct UserSetting import namespace and add test coverage

This commit is contained in:
2026-09-07 18:34:51 +02:00
parent 208efbb85d
commit 3502c3e85b
34 changed files with 2497 additions and 2 deletions
@@ -0,0 +1,28 @@
<?php
namespace Tests\Unit\Providers;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Gate;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class HorizonServiceProviderTest extends TestCase
{
use RefreshDatabase;
#[Test]
public function it_defines_view_horizon_gate(): void
{
$this->assertTrue(Gate::has('viewHorizon'));
}
#[Test]
public function it_denies_access_for_users_not_in_list(): void
{
$user = User::factory()->create();
$this->assertFalse(Gate::forUser($user)->allows('viewHorizon'));
}
}
@@ -0,0 +1,51 @@
<?php
namespace Tests\Unit\Providers;
use App\Providers\TypeScriptTransformerServiceProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use Spatie\LaravelTypeScriptTransformer\TypeScriptTransformerApplicationServiceProvider as BaseTypeScriptTransformerServiceProvider;
use Spatie\TypeScriptTransformer\TypeScriptTransformerConfigFactory;
use Tests\TestCase;
class TypeScriptTransformerServiceProviderTest extends TestCase
{
#[Test]
public function it_is_a_service_provider(): void
{
$provider = new TypeScriptTransformerServiceProvider($this->app);
$this->assertInstanceOf(BaseTypeScriptTransformerServiceProvider::class, $provider);
}
#[Test]
public function it_configures_transformers(): void
{
$config = $this->createMock(TypeScriptTransformerConfigFactory::class);
$config->expects($this->exactly(3))
->method('transformer')
->willReturnSelf();
$config->expects($this->once())
->method('transformDirectories')
->willReturnSelf();
$config->expects($this->once())
->method('writer')
->willReturnSelf();
$config->expects($this->once())
->method('formatter')
->willReturnSelf();
$provider = new TypeScriptTransformerServiceProvider($this->app);
$reflection = new \ReflectionClass($provider);
$method = $reflection->getMethod('configure');
$method->setAccessible(true);
$method->invoke($provider, $config);
}
}