public function testGetHoursSinceLastCrawlerRun()
 {
     $dao = new InstanceMySQLDAO();
     $instance_builder = FixtureBuilder::build('instances', array('crawler_last_run' => '-3h'));
     $hours = $dao->getHoursSinceLastCrawlerRun();
     $this->assertEqual($hours, 3);
     $instance1_builder = FixtureBuilder::build('instances', array('crawler_last_run' => '-2h'));
     $hours = $dao->getHoursSinceLastCrawlerRun();
     $this->assertEqual($hours, 2);
 }
 public function testGetHoursSinceLastCrawlerRun()
 {
     $dao = new InstanceMySQLDAO();
     //set all existing instances to inactive first
     $dao->setActive(1, 0);
     $dao->setActive(2, 0);
     $dao->setActive(3, 0);
     $dao->setActive(4, 0);
     $dao->setActive(5, 0);
     $builders[] = FixtureBuilder::build('instances', array('crawler_last_run' => '-3h', 'is_active' => 1));
     $hours = $dao->getHoursSinceLastCrawlerRun();
     $this->assertEqual($hours, 3);
     $builders[] = FixtureBuilder::build('instances', array('crawler_last_run' => '-2h', 'is_active' => 1));
     $hours = $dao->getHoursSinceLastCrawlerRun();
     $this->assertEqual($hours, 3);
     // test that it ignores inactive instances
     $builders[] = FixtureBuilder::build('instances', array('crawler_last_run' => '-1h', 'is_active' => 0));
     $hours = $dao->getHoursSinceLastCrawlerRun();
     $this->assertEqual($hours, 3);
 }