Beispiel #1
0
 /**
  * @vcr products_instance
  */
 function testProductsInstance()
 {
     $products = Products::instance();
     $test = $products->getById('3b754bc2-48f8-4388-b5b5-2631098d03de');
     $this->assertEquals('CiviCRM Starter Kit', $test['longname']);
     $test = $products->query();
     $this->assertNotEmpty($test);
 }
Beispiel #2
0
 /**
  * Search for Pantheon product info
  *
  * ### OPTIONS
  *
  * [--category=<category>]
  * : general, publishing, commerce, etc
  *
  * [--type=<type>]
  * : Pantheon internal product 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);
     $products = Products::instance();
     $this->handleDisplay($products->query($assoc_args), $assoc_args);
     return $products;
 }
Beispiel #3
0
 /**
  * @param $args array of args to parse value from.
  * @param $exit (boolean) if true throw error when no value is found.
  *
  * @return product array
  */
 public static function product($args, $key, $exit = true)
 {
     if (isset($assoc_args[$key])) {
         $product = Products::getByIdOrName($assoc_args[$key]);
         if (!$product) {
             \Terminus::error("Couldn't find product: %s", array($assoc_args['product']));
         }
     } else {
         $product = \Terminus::menu(Products::selectList());
         $product = Products::getByIndex($product);
     }
     if (!$product and $exit) {
         \Terminus::error("Product is required.");
     }
     return $product;
 }