/** * getGameType - interaction to establish the different game types * * @param OutputInterface $output * @return string */ protected function getGameType(OutputInterface $output) { //set up the default type $defaultType = Sevens::gameName(); $question = array("\n\n******************************GAMES AVALABLE******************************\n\n" . Sevens::gameInformation() . "**************************************************************************\n\n", "<question>Please choose a card game to play:</question> [<comment>{$defaultType}</comment>] "); $gameType = $this->getHelper('dialog')->askAndValidate($output, $question, function ($typeInput) { if (!in_array($typeInput, array(Sevens::gameName()))) { throw new \InvalidArgumentException('Invalid game type'); } return $typeInput; }, 3, $defaultType); return $gameType; }
/** * @covers Cilex\Games\Sevens::gameInformation */ public function testInformation() { $this->assertStringMatchesFormat('%a', \Cilex\Games\Sevens::gameInformation()); }