Ejemplo n.º 1
0
 /**
  * restores svn directories
  *
  * @return void
  */
 protected function _restoreSvnFromBackup()
 {
     foreach ($this->_svn as $current_path => $new_path) {
         $this->_output('trying to restore .svn directory to ' . $new_path, true);
         $success = @rename($current_path, $new_path);
         // if the new path no longer exists then that means it was either moved or removed
         // in this case we should delete the svn backup cause we no longer need it
         if (!$success) {
             $this->_output('directory at ' . str_replace(DIRECTORY_SEPARATOR . '.svn', '', $new_path) . ' no longer exists', true);
             $this->_output('removing dir ' . $current_path, true);
             Util::removeDir($current_path);
         }
     }
 }
Ejemplo n.º 2
0
 public function testToSeconds()
 {
     $time = time();
     $this->isEqual($time, Util::toSeconds($time));
     $time = '1 second';
     $this->isEqual(1, Util::toSeconds($time));
     $time = '10 seconds';
     $this->isEqual(10, Util::toSeconds($time));
     $time = '1 minute';
     $this->isEqual(60, Util::toSeconds($time));
     $time = '60 minutes';
     $this->isEqual(3600, Util::toSeconds($time));
     $time = '1 hour';
     $this->isEqual(3600, Util::toSeconds($time));
     $time = '2 hours';
     $this->isEqual(7200, Util::toSeconds($time));
     $time = '1 day';
     $this->isEqual(86400, Util::toSeconds($time));
     $time = '7 days';
     $this->isEqual(604800, Util::toSeconds($time));
     $time = '1 week';
     $this->isEqual(604800, Util::toSeconds($time));
     $time = '5 weeks';
     $this->isEqual(3024000, Util::toSeconds($time));
     $time = '1 year';
     $this->isEqual(31556926, Util::toSeconds($time));
     $time = '99 years';
     $this->isEqual(3124135673.0, Util::toSeconds($time));
     $this->isException('Sonic\\Exception');
     $time = 'what';
     Util::toSeconds($time);
 }