function testSchemeCreate() { $scheme = new Scheme(TypeJeu::keno()); $scheme->setDraw(new \DateTime(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [3]); $this->assertEquals(count($scheme->getNumbers(false)) + count($scheme->getNumbers(true)), 11); $scheme->setDistance(10); $this->assertEquals($scheme->getDistance(), 10); $this->assertTrue($scheme->hasNumber(new Number(5, false))); $this->assertTrue($scheme->hasNumber(new Number(3, true))); $this->assertFalse($scheme->hasNumber(new Number(10, true))); $this->assertCount(10, $scheme->getNumbers(false)); }
private function csvFileParse(array $idxNumbers, array $idxExtras) { if (!file_exists($this->csvFilePath)) { throw new \Exception("Fichier csv non trouvé à l'emplacement: " . $this->csvFilePath); } $dateCellIndex = 1; $lines = file($this->csvFilePath); while (($line = $lines[$this->distance + 1]) != null && $this->distance < 1101) { $this->csvLine = explode(";", $line); $scheme = new Scheme($this->game); $sDate = $this->csvLine[$dateCellIndex]; $scheme->setDraw(\DateTime::createFromFormat('d/m/Y', $sDate), $this->getMatchingLineNumbers($idxNumbers), $this->getMatchingLineNumbers($idxExtras)); $scheme->setDistance($this->distance); $this->schemes->add($scheme); $this->distance++; } }