|
6 | 6 | use App\Services\Lottery\Solvers\Glpk\Enums\Task; |
7 | 7 | use App\Services\Lottery\Solvers\Glpk\TaskRunners\UnitDistribution; |
8 | 8 |
|
9 | | - |
10 | 9 | uses()->group('Unit.Lottery.Glpk'); |
11 | 10 |
|
12 | 11 | beforeEach(function () { |
|
26 | 25 | $timeout = 10; |
27 | 26 |
|
28 | 27 | $runner = app(UnitDistribution::class); |
29 | | - $result = $runner->execute($spec, $timeout, ['min_satisfaction' => 2]); |
| 28 | + $result = $runner |
| 29 | + ->withContext(['min_satisfaction' => 2]) |
| 30 | + ->execute($spec, $timeout); |
30 | 31 |
|
31 | 32 | // Check TaskResult structure |
32 | 33 | expect($result->task)->toBe(Task::UNIT_DISTRIBUTION); |
|
55 | 56 |
|
56 | 57 | $runner = app(UnitDistribution::class); |
57 | 58 |
|
58 | | - expect(fn () => $runner->execute($spec, $timeout, [])) |
| 59 | + expect(fn () => $runner->execute($spec, $timeout)) |
59 | 60 | ->toThrow(InvalidArgumentException::class, 'UnitDistribution requires min_satisfaction in context'); |
60 | 61 | }); |
61 | 62 |
|
|
68 | 69 |
|
69 | 70 | $runner = app(UnitDistribution::class); |
70 | 71 |
|
71 | | - expect(fn () => $runner->execute($spec, $timeout, ['min_satisfaction' => null])) |
| 72 | + expect(fn () => $runner->execute($spec, $timeout)) |
72 | 73 | ->toThrow(InvalidArgumentException::class, 'UnitDistribution requires min_satisfaction in context'); |
73 | 74 | }); |
74 | 75 |
|
|
85 | 86 | $timeout = 10; |
86 | 87 |
|
87 | 88 | $runner = app(UnitDistribution::class); |
88 | | - $result = $runner->execute($spec, $timeout, ['min_satisfaction' => 2]); |
| 89 | + $result = $runner |
| 90 | + ->withContext(['min_satisfaction' => 2]) |
| 91 | + ->execute($spec, $timeout); |
89 | 92 |
|
90 | 93 | $distribution = $result->get('distribution'); |
91 | 94 |
|
|
108 | 111 | $timeout = 5; |
109 | 112 |
|
110 | 113 | $runner = app(UnitDistribution::class); |
111 | | - $result = $runner->execute($spec, $timeout, ['min_satisfaction' => 1]); |
| 114 | + $result = $runner |
| 115 | + ->withContext(['min_satisfaction' => 1]) |
| 116 | + ->execute($spec, $timeout); |
112 | 117 |
|
113 | 118 | $metadata = $result->metadata; |
114 | 119 |
|
|
140 | 145 | $runner = app(UnitDistribution::class); |
141 | 146 |
|
142 | 147 | // Test with S=1 (strict) |
143 | | - $result1 = $runner->execute($spec, $timeout, ['min_satisfaction' => 1]); |
| 148 | + $result1 = $runner |
| 149 | + ->withContext(['min_satisfaction' => 1]) |
| 150 | + ->execute($spec, $timeout); |
144 | 151 | expect($result1->get('distribution'))->toHaveCount(3); |
145 | 152 |
|
146 | 153 | // Test with S=2 (relaxed) |
147 | | - $result2 = $runner->execute($spec, $timeout, ['min_satisfaction' => 2]); |
| 154 | + $result2 = $runner |
| 155 | + ->withContext(['min_satisfaction' => 2]) |
| 156 | + ->execute($spec, $timeout); |
148 | 157 | expect($result2->get('distribution'))->toHaveCount(3); |
149 | 158 |
|
150 | 159 | // Test with S=3 (very relaxed) |
151 | | - $result3 = $runner->execute($spec, $timeout, ['min_satisfaction' => 3]); |
| 160 | + $result3 = $runner |
| 161 | + ->withContext(['min_satisfaction' => 3]) |
| 162 | + ->execute($spec, $timeout); |
152 | 163 | expect($result3->get('distribution'))->toHaveCount(3); |
153 | 164 | }); |
154 | 165 | }); |
0 commit comments