public function testIncorrect()
 {
     $dom = SimpleHtmlDom::fromUrl(__DIR__ . '/incorrect.html');
     $a = new LuckyNumberParser();
     $result = $a->getLuckyNumber($dom);
     $this->assertEquals(null, $result);
     $this->assertGreaterThan(0, count($a->getErrors()));
 }
Пример #2
0
 private function updateLuckyNumbers($dom)
 {
     $model = new LuckyNumberRepository();
     $parser = new LuckyNumberParser();
     $remote = $parser->getLuckyNumber($dom);
     $this->logErrors('LuckyNumberParser', $parser->getErrors());
     if ($remote !== null) {
         $local = $model->getByDate($remote->date);
         if ($local === null || $remote->value !== $local->value) {
             $model->setValue($remote->date, $remote->value);
             echo "updated ln/{$remote->date}\n";
         }
     }
 }