Example #1
0
 public function testLinkQuery()
 {
     $date = date('Y-m-d');
     /**
      * @see Zend_Service_Simpy_LinkQuery
      */
     require_once 'Zend/Service/Simpy/LinkQuery.php';
     $linkQuery = new Zend_Service_Simpy_LinkQuery();
     $linkQuery->setQueryString($this->_link['title']);
     $linkQuery->setBeforeDate($date);
     $this->assertNull($linkQuery->getDate(), 'Date has been initialized');
     $linkQuery->setAfterDate($date);
     $this->assertNull($linkQuery->getDate(), 'Date has been initialized');
     $linkQuery->setDate($date);
     $this->assertNull($linkQuery->getBeforeDate(), 'Before date has retained its value');
     $this->assertNull($linkQuery->getAfterDate(), 'After date has retained its value');
     $linkQuery->setLimit(1)->setDate(null);
     $this->assertEquals($linkQuery->getLimit(), 1, 'Limit was not set');
     $linkQuery->setLimit(array());
     $this->assertNull($linkQuery->getLimit(), 'Invalid limit value was accepted');
     $linkSet = $this->_simpy->getLinks($linkQuery);
     $this->assertEquals($linkSet->getLength(), 1, 'Link set does not have the expected size');
 }
Example #2
0
 /**
  * Performs a query on existing links and returns the results or returns all
  * links if no particular query is specified (which should be used sparingly
  * to prevent overloading Simpy servers)
  *
  * @param  Zend_Service_Simpy_LinkQuery $q Query object to use (optional)
  * @return Zend_Service_Simpy_LinkSet
  */
 public function getLinks(Zend_Service_Simpy_LinkQuery $q = null)
 {
     if ($q != null) {
         $query = array('q' => $q->getQueryString(), 'limit' => $q->getLimit(), 'date' => $q->getDate(), 'afterDate' => $q->getAfterDate(), 'beforeDate' => $q->getBeforeDate());
         $doc = $this->_makeRequest('GetLinks', $query);
     } else {
         $doc = $this->_makeRequest('GetLinks');
     }
     /**
      * @see Zend_Service_Simpy_LinkSet
      */
     require_once 'Zend/Service/Simpy/LinkSet.php';
     return new Zend_Service_Simpy_LinkSet($doc);
 }
Example #3
0
 /**
  * Performs a query on existing links and returns the results
  *
  * @param Zend_Service_Simpy_LinkQuery $q Query object to use
  * @return Zend_Service_Simpy_LinkSet
  */
 public function getLinks(Zend_Service_Simpy_LinkQuery $q)
 {
     $query = array('q' => $q->getQueryString(), 'limit' => $q->getLimit(), 'date' => $q->getDate(), 'afterDate' => $q->getAfterDate(), 'beforeDate' => $q->getBeforeDate());
     $doc = $this->_makeRequest('GetLinks', $query);
     return new Zend_Service_Simpy_LinkSet($doc);
 }