/** * Instantiates object, sets cache and session * * @return [TerminusCommand] $this */ 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(); if (!Terminus::isTest()) { $this->checkForUpdate(); } }
public function testSetOutputter() { // This test assumes that the format defaults to JSON. $formatter = Terminus::getOutputter()->getFormatter(); $this->assertTrue(strpos(get_class($formatter), 'JSON') !== false); // This test assumes that the format defaults to Bash. Terminus::setOutputter('bash', 'php://stdout'); $formatter = Terminus::getOutputter()->getFormatter(); $this->assertTrue(strpos(get_class($formatter), 'Bash') !== false); Terminus::setOutputter('normal', 'php://stdout'); $formatter = Terminus::getOutputter()->getFormatter(); $this->assertTrue(strpos(get_class($formatter), 'Pretty') !== false); }