/** * Search for Pantheon upstream info * * ### OPTIONS * * [--category=<category>] * : general, publishing, commerce, etc * * [--type=<type>] * : Pantheon internal upstream type definition * * [--framework=<drupal|wordpress>] * : Filter based on framework * * @subcommand list * @alias all **/ public function all($args = array(), $assoc_args = array()) { $defaults = array('type' => '', 'category' => '', 'framework' => ''); $assoc_args = array_merge($defaults, $assoc_args); $upstreams = Upstreams::instance(); $this->handleDisplay($upstreams->query($assoc_args), $assoc_args); return $upstreams; }
/** * @vcr upstreams_instance */ function testUpstreamsInstance() { $upstreams = Upstreams::instance(); $test = $upstreams->getById('3b754bc2-48f8-4388-b5b5-2631098d03de'); $this->assertEquals('CiviCRM Starter Kit', $test['longname']); $test = $upstreams->query(); $this->assertNotEmpty($test); }
/** * Helper function to select valid upstream * * @param [array] $args Args to parse value from * @param [string] $key Index to search for in args * @param [boolean] $exit If true, throw error when no value is found * * @return [array] $upstream */ public static function upstream($args, $key, $exit = true) { if (isset($args[$key])) { $upstream = Upstreams::getByIdOrName($args[$key]); if (!$upstream) { \Terminus::error("Couldn't find upstream: %s", array($args['upstream'])); } } else { $upstream = \Terminus::menu(Upstreams::selectList()); $upstream = Upstreams::getByIndex($upstream); } if (!$upstream and $exit) { \Terminus::error("Upstream is required."); } return $upstream; }