Example #1
0
 /**
  * Initializes the object.
  *
  * @param string $operator Operator used for the expression
  * @param string $name Name of variable that should be compared.
  * @param mixed $value Value that the variable should be compared to
  */
 public function __construct($operator, $name, $value)
 {
     if (!isset(self::$_operators[$operator])) {
         throw new MW_Common_Exception(sprintf('Invalid operator "%1$s"', $operator));
     }
     parent::__construct($operator, $name, $value);
 }
Example #2
0
 /**
  * Initializes the object.
  *
  * @param MW_DB_Connection_Interface $conn Database connection object
  * @param string $operator Operator used for the expression
  * @param string $name Name of variable or column that should be compared.
  * @param mixed $value Value that the variable or column should be compared to
  */
 public function __construct(MW_DB_Connection_Interface $conn, $operator, $name, $value)
 {
     if (!isset(self::$_operators[$operator])) {
         throw new MW_Common_Exception(sprintf('Invalid operator "%1$s"', $operator));
     }
     parent::__construct($operator, $name, $value);
     $this->_conn = $conn;
 }
Example #3
0
 public function testCreateFunction()
 {
     $func = MW_Common_Criteria_Expression_Compare_Abstract::createFunction('test', array(true, 1, 0.1, 'string', array(2, 3)));
     $this->assertEquals('test(1,1,0.1,"string",[2,3])', $func);
 }