Example #1
0
 /**
  * @expectedException \PHPUnit_Framework_Error_Notice
  * @medium
  */
 public function testAutomaticUpdatePlan()
 {
     $fileUtil = new FileUtil();
     $file = tempnam($fileUtil->getTempDirectory(), 'bavtest');
     touch($file, strtotime("-1 year"));
     $backend = new FileDataBackend($file);
     $updatePlan = new AutomaticUpdatePlan();
     $this->assertTrue($updatePlan->isOutdated($backend));
     $updatePlan->perform($backend);
     $this->assertFalse($updatePlan->isOutdated($backend));
 }
Example #2
0
 /**
  * Tests automatic installation.
  */
 public function testAutomaticUpdate()
 {
     $updatePlan = new AutomaticUpdatePlan();
     $updatePlan->setNotice(false);
     ConfigurationRegistry::getConfiguration()->setUpdatePlan($updatePlan);
     $fileUtil = new FileUtil();
     $container = new FileDataBackendContainer(tempnam($fileUtil->getTempDirectory(), 'bavtest'));
     $backend = $container->getDataBackend();
     touch($backend->getFile(), strtotime("-1 year"));
     $this->assertTrue($updatePlan->isOutdated($backend));
     $container->applyUpdatePlan($backend);
     $this->assertFalse($updatePlan->isOutdated($backend));
     $backend->uninstall();
     ConfigurationRegistry::getConfiguration()->setUpdatePlan(null);
 }