Exemplo n.º 1
0
 public function testInstanceOfPerSetters()
 {
     $like = new Like();
     $this->assertInstanceOf('Zend\\Db\\Sql\\Predicate\\Like', $like->setIdentifier('bar'));
     $this->assertInstanceOf('Zend\\Db\\Sql\\Predicate\\Like', $like->setSpecification('%1$s LIKE %2$s'));
     $this->assertInstanceOf('Zend\\Db\\Sql\\Predicate\\Like', $like->setLike('foo%'));
 }
Exemplo n.º 2
0
 public function testGetExpressionData()
 {
     $like = new Like('bar', 'Foo%');
     $this->assertEquals(
         array(
             array('%1$s LIKE %2$s', array('bar', 'Foo%'), array($like::TYPE_IDENTIFIER, $like::TYPE_VALUE))
         ),
         $like->getExpressionData()
     );
 }
Exemplo n.º 3
0
 /**
  *	Like
  *	like(In Expression)
  */
 public function like($identifier = NULL, $like = NULL)
 {
     $return = array();
     if ($identifier === NULL or $identifier === '') {
         $identifier = $this->getStructure();
     }
     $value = $this->extractOperation($identifier, $like);
     $return = array();
     foreach ($value as $array) {
         $like = new Like();
         $like->setIdentifier($array[0]);
         $like->setLike($array[1]);
         array_push($return, $like);
     }
     return $return;
 }
Exemplo n.º 4
0
 public function __construct($identifier, $like)
 {
     $like = str_replace(" ", "%", $like);
     parent::__construct($identifier, $like);
 }