Files
lotteryLaravel/tests/Feature/SettlementMatcherRegistryCompletenessTest.php

25 lines
884 B
PHP

<?php
use App\Models\PlayType;
use App\Services\Settlement\Matchers\NoopSettlementMatcher;
use App\Services\Settlement\SettlementMatcherRegistry;
use Database\Seeders\PlayTypeSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(fn () => $this->seed(PlayTypeSeeder::class));
test('every play_types.play_code maps to a non-noop settlement matcher', function (): void {
$reg = app(SettlementMatcherRegistry::class);
foreach (PlayType::query()->orderBy('play_code')->pluck('play_code') as $code) {
$matcher = $reg->for((string) $code);
expect($matcher)->not->toBeInstanceOf(NoopSettlementMatcher::class);
}
});
test('half_box reuses the same matcher instance as big spread', function (): void {
$reg = app(SettlementMatcherRegistry::class);
expect($reg->for('half_box'))->toBe($reg->for('big'));
});