Some improvements

This commit is contained in:
armel committed 2026-09-08 22:33:51 +02:00
1 parent a914bd74fe
commit 729c0be834
16 files changed
+577 -36

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Tests\Feature;
use App\Events\GameSnapshot;
use App\Game\Room;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
final class GameSnapshotTest extends TestCase
{
#[Test]
public function broadcast_payload_discloses_message_size_cap(): void
{
$room = new Room('test');
$payload = (new GameSnapshot($room, [], [], []))->broadcastWith();
$this->assertArrayHasKey('msgCap', $payload);
$this->assertSame(
(int) config('reverb.apps.apps.0.max_message_size', 0),
$payload['msgCap'],
'client debug HUD reports the same cap the Reverb server enforces',
);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Tests\Feature;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
final class GameStressTestTest extends TestCase
{
#[Test]
public function unknown_scenario_rejects_with_failure(): void
{
$this->artisan('game:stress', ['--scenario' => 'aliens'])
->expectsOutputToContain('Unknown scenario')
->assertExitCode(1);
}
#[Test]
public function step_below_one_rejects_with_failure(): void
{
$this->artisan('game:stress', ['--step' => '0'])
->expectsOutputToContain('Invalid sweep range')
->assertExitCode(1);
}
#[Test]
public function inverted_range_rejects_with_failure(): void
{
$this->artisan('game:stress', ['--entities-from' => '200', '--entities-to' => '100'])
->expectsOutputToContain('Invalid sweep range')
->assertExitCode(1);
}
#[Test]
public function breakpoint_run_reports_capacity_limits(): void
{
$this->artisan('game:stress', [
'--entities-from' => '50',
'--entities-to' => '50',
'--step' => '50',
'--ticks' => '5',
'--breakpoint-only' => true,
])
->expectsOutputToContain('Derived capacity limits')
->expectsOutputToContain('Reverb cap')
->assertExitCode(0);
}
}