/**
  * 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'];
     $this->loadHelpers();
     if (!Utils\isTest()) {
         Utils\checkForUpdate();
     }
 }
Example #2
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());
     }
 }
Example #3
0
 public function testIsTest()
 {
     $this->assertTrue(Utils\isTest());
     putenv('CLI_TEST_MODE=');
     putenv("TERMINUS_TEST_IGNORE=1");
     putenv("VCR_CASSETTE=1");
     $this->assertFalse(Utils\isTest());
     putenv("TERMINUS_TEST_IGNORE=");
     putenv('CLI_TEST_MODE=1');
     putenv("VCR_CASSETTE=");
 }
Example #4
0
 /**
  * Checks to see if the current user is logged in
  *
  * @return bool True if the user is logged in
  */
 public function loggedIn()
 {
     $session = Session::instance()->getData();
     $is_logged_in = isset($session->session) && (Utils\isTest() || $session->session_expire_time >= time());
     return $is_logged_in;
 }