Example #1
0
 /**
  * @vcr utils#checkCurrentVersion
  */
 public function testCheckForUpdate()
 {
     Utils\checkForUpdate();
     $log_file = $_SERVER['TERMINUS_LOG_DIR'] . 'log_' . date('Y-m-d') . '.txt';
     $file_contents = explode("\n", file_get_contents($log_file));
     $this->assertFalse(strpos(array_pop($file_contents), 'An update to Terminus is available.'));
 }
Example #2
0
 /**
  * @vcr utils#checkCurrentVersion
  */
 public function testCheckForUpdate()
 {
     $log_file = getLogFileName();
     setOutputDestination($log_file);
     Terminus::getCache()->putData('latest_release', ['check_date' => strtotime('8 days ago')]);
     Utils\checkForUpdate();
     $file_contents = explode("\n", file_get_contents($log_file));
     $this->assertFalse(strpos(array_pop($file_contents), 'An update to Terminus is available.'));
     resetOutputDestination($log_file);
 }
Example #3
0
 /**
  * Instantiates object, sets cache and session
  *
  * @param array $options Elements as follow:
  *        FileCache cache
  *        Logger    Logger
  *        Outputter Outputter
  *        Session   Session
  * @return TerminusCommand
  */
 public function __construct(array $options = [])
 {
     $this->cache = $options['cache'];
     $this->logger = $options['logger'];
     $this->outputter = $options['outputter'];
     $this->session = $options['session'];
     if (!Terminus::isTest()) {
         Utils\checkForUpdate();
     }
 }
Example #4
0
 /**
  * Instantiates object, sets cache and session
  */
 public function __construct()
 {
     //Load commonly used data from cache
     $this->cache = Terminus::getCache();
     $this->logger = Terminus::getLogger();
     $this->outputter = Terminus::getOutputter();
     $this->session = Session::instance();
     $this->request = new Request();
     if (!Terminus::isTest()) {
         Utils\checkForUpdate();
     }
 }
Example #5
0
 /**
  * Instantiates object, sets cache and session
  *
  * @param array $options Elements as follow:
  *        FileCache cache
  *        Logger    Logger
  *        Outputter Outputter
  *        Session   Session
  * @return TerminusCommand
  */
 public function __construct(array $options = [])
 {
     $this->cache = new FileCache();
     $this->runner = $options['runner'];
     $this->session = Session::instance();
     $this->logger = $this->runner->getLogger();
     $this->outputter = $this->runner->getOutputter();
     $this->loadHelpers();
     if (!Utils\isTest()) {
         Utils\checkForUpdate($this->log());
     }
 }