/** * @param Sudoku $sudoku */ public function check(Sudoku $sudoku) { foreach ($sudoku->getRows() as $row) { $this->uniqueValidator->validate($row->getAsArray()); $this->sequenceValidator->validate($row->getAsArray()); } foreach ($sudoku->getColumns() as $column) { $this->uniqueValidator->validate($column->getAsArray()); $this->sequenceValidator->validate($column->getAsArray()); } foreach ($sudoku->getBoxes() as $box) { $this->uniqueValidator->validate($box->getAs1dArray()); $this->sequenceValidator->validate($box->getAs1dArray()); } }
/** * @expectedException \RuntimeException */ public function testArrayWithDuplicatedElements() { $array = array(1, 2, 2, 3, 4, 5); $this->validator->validate($array); }