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
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Tests\Unit\Data;
use App\Features\Scraper\Data\ScraperResultData;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ScraperResultDataTest extends TestCase
{
#[Test]
public function it_can_be_created_from_array(): void
{
$data = ScraperResultData::from([
'id' => 123,
'title' => 'Super Mario Bros',
'cover_url' => 'https://example.com/cover.jpg',
'year' => '1985',
'source' => 'igdb',
]);
$this->assertEquals(123, $data->id);
$this->assertEquals('Super Mario Bros', $data->title);
$this->assertEquals('https://example.com/cover.jpg', $data->coverUrl);
$this->assertEquals('1985', $data->year);
$this->assertEquals('igdb', $data->source);
}
#[Test]
public function it_handles_null_optional_fields(): void
{
$data = ScraperResultData::from([
'id' => 1,
'title' => 'Test Game',
'cover_url' => null,
'year' => null,
'source' => 'thegamesdb',
]);
$this->assertNull($data->coverUrl);
$this->assertNull($data->year);
}
}