/** * Create cards array for tests * * @return Card[] */ public static function getCardsArray() : array { $cardsArray = array(); foreach (self::getCardsDataArray() as $cardData) { $figure = $cardData[0]; $suit = $cardData[1] ?? null; $visible = $cardData[2] ?? null; if ($suit !== null) { $card = new Card($figure, $suit); } else { $card = new Card($figure); } if ($visible !== null) { $card->setVisible($visible); } $cardsArray[] = $card; } return $cardsArray; }
/** * @dataProvider \Bnowak\CardGame\Tests\TestDataProvider::getCardsDataArray */ public function testVisible(string $figure, string $suit = null, bool $isVisible = false) { $card = new Card($figure, $suit); $card->setVisible($isVisible); $this->assertSame($isVisible, $card->isVisible()); }