<?phpnamespace Tests;use App\Scene\TitleScene;use App\Ui\Look;use JumPHP\Testing\GameTestCase;use Symfony\Component\Yaml\Yaml;/** Every text of the game exists in the playground's 14 languages, and the menu switches language (and font) from its Language row. */final class LanguagesTest extends GameTestCase{ public function testEveryLanguageHasEveryText(): void { $tables = Yaml::parseFile(dirname(__DIR__) . '/config/lang.yaml'); $keys = array_keys($tables['en']); foreach (array_keys(Look::LANGUAGES) as $lang) { self::assertArrayHasKey($lang, $tables, $lang); self::assertSame([], array_values(array_diff($keys, array_keys($tables[$lang]))), "texts missing in $lang"); } } public function testTheLanguageRowChangesTheLanguage(): void { $this->game->start(TitleScene::class, ['lang' => 'en']); $this->game->press('down', 1)->press('down', 1)->press('down', 1); // the Language row $this->game->press('right', 2); self::assertSame('fr', $this->game->engine->lang->getLang()); $this->game->press('left', 2)->press('left', 2); self::assertSame('ko', $this->game->engine->lang->getLang()); $this->game->shot('title-ko'); }}