public function testbuild_query_where() { $aowWorkFlow = new AOW_WorkFlow(); //populate required values $call = new Call(); $aowCondition = new AOW_Condition(); $aowCondition->name = 'test'; $aowCondition->module_path = base64_encode(serialize(array(''))); $aowCondition->field = 'name'; $aowCondition->value = 'testval'; //test with contains operator $aowCondition->operator = 'Contains'; $aowCondition->value_type = 'Value'; $expected = array('where' => array(".name LIKE CONCAT('%', 'testval' ,'%')")); $query = $aowWorkFlow->build_query_where($aowCondition, $call); $this->assertEquals($expected, $query); //test for starts with operator $aowCondition->operator = 'Starts_With'; $aowCondition->value_type = 'Value'; $expected = array('where' => array(".name LIKE CONCAT('testval' ,'%')")); $query = $aowWorkFlow->build_query_where($aowCondition, $call); $this->assertEquals($expected, $query); //test for Equal_To operator $aowCondition->operator = 'Equal_To'; $aowCondition->value_type = 'Value'; $expected = array('where' => array(".name = 'testval'")); $query = $aowWorkFlow->build_query_where($aowCondition, $call); $this->assertEquals($expected, $query); //test with value type Date $aowCondition->operator = 'Equal_To'; $aowCondition->value_type = 'Date'; $expected = array('where' => array('.name = DATE_ADD(calls., INTERVAL )')); $query = $aowWorkFlow->build_query_where($aowCondition, $call); $this->assertEquals($expected, $query); //test with value type Field $aowCondition->operator = 'Equal_To'; $aowCondition->value_type = 'Field'; $expected = array('where' => array('.name = calls.testval')); $query = $aowWorkFlow->build_query_where($aowCondition, $call); $this->assertEquals($expected, $query); }