Example #1
0
 /**
  * Get tiles will require filter_id
  * {@inheritdoc} Will need to pass filter_id in the array of options
  *
  * @param integer $filter_id filter id
  * @param integer $limit default value is 25
  * @param integer $page default value is 1
  * @param array $options optional data
  * @param bool $force force to
  *
  * @return mixed    Will return FALSE if the API connection is failed
  *                  otherwise will return json object
  */
 public function get()
 {
     $arg_list = func_get_args();
     if (!isset($arg_list[0]) || empty($arg_list[0])) {
         $message = sprintf('Missing argument 1 to %s::%s() must be an integer.', get_class($this), __METHOD__);
         throw new \Exception($message);
     }
     $filter = new Filter($this->configs, $arg_list[0], false);
     $limit = isset($arg_list[1]) ? $arg_list[1] : 25;
     $page = isset($arg_list[2]) ? $arg_list[2] : 1;
     $options = isset($arg_list[3]) ? $arg_list[3] : array();
     $force = isset($arg_list[4]) ? $arg_list[4] : false;
     $tiles = $filter->getContents($limit, $page, $options, $force);
     $this->records = $tiles;
     return $this;
 }
Example #2
0
 /**
  * @depends testCreate
  */
 public function testRemove(Filter $filterRes)
 {
     $res = $filterRes->delete();
     $this->assertNotFalse($res, 'Delete request Error');
     if ($res) {
         try {
             $filter = $this->stack->instance('filter');
             $filter->getById($filterRes->id);
         } catch (\Exception $e) {
             // Requested filter not exists
         }
         // $filter should be empty because of the deletion
         $this->assertEquals(0, count($filter));
         $this->assertGreaterThan(0, count($filter->getErrors()));
         $this->assertEquals(0, count($filterRes->getErrors()));
     }
 }