init
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

This commit is contained in:
jiangdong.cheng
2026-02-11 17:28:36 +08:00
parent dcb82557c7
commit aa16c9f8c2
162 changed files with 22333 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Tests\Unit;
use App\Models\AiModel;
use App\Services\ModelScoringService;
use Tests\TestCase;
class ModelScoringServiceTest extends TestCase
{
public function test_it_calculates_weighted_score(): void
{
$service = new ModelScoringService();
$score = $service->calculateTotal(90, 70, 80);
$this->assertSame(82, $score);
}
public function test_it_bounds_scores_when_apply_called(): void
{
$service = new ModelScoringService();
$model = new AiModel([
'effectiveness_score' => 120,
'price_score' => -10,
'speed_score' => 80,
]);
$service->apply($model);
$this->assertSame(66, $model->total_score);
}
}