FR
games/alis / tests / RevisitedTest.php · commit 9c722cf
<?phpnamespace Tests;use App\Revisited\Survivor;use App\Scene\RevisitedScene;use JumPHP\Testing\GameTestCase;final class RevisitedTest extends GameTestCase{    public function testTheCastawayWalksAndGetsThirsty(): void    {        $this->game->start(RevisitedScene::class, ['seed' => 7]);        $x = $this->game->peek('x');        $z = $this->game->peek('z');        $this->game->hold('up', 120);        self::assertGreaterThan(3.0, hypot($this->game->peek('x') - $x, $this->game->peek('z') - $z));        /** @var Survivor $body */        $body = $this->game->peek('body');        self::assertLessThan(70, $body->water);        $this->game->shot('revisited');    }    public function testWithoutWaterTheBodyGivesUp(): void    {        $body = new Survivor();        $body->water = 0;        $body->food = 0;        for ($h = 0; $h < 48 && !$body->dead(); $h++) {            $body->live(60, 0.5, false, false);        }        self::assertTrue($body->dead());    }}