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%')); }
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() ); }
/** * 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; }
public function __construct($identifier, $like) { $like = str_replace(" ", "%", $like); parent::__construct($identifier, $like); }