/** * Regression test * * @test */ public function compileWhereClauseDoesNotDropClauses() { $clauses = array(0 => array('modifier' => '', 'table' => 'pages', 'field' => 'fe_group', 'calc' => '', 'comparator' => '=', 'value' => array(0 => '', 1 => '\'')), 1 => array('operator' => 'OR', 'modifier' => '', 'func' => array('type' => 'IFNULL', 'default' => array(0 => '1', 1 => '\''), 'table' => 'pages', 'field' => 'fe_group')), 2 => array('operator' => 'OR', 'modifier' => '', 'table' => 'pages', 'field' => 'fe_group', 'calc' => '', 'comparator' => '=', 'value' => array(0 => '0', 1 => '\'')), 3 => array('operator' => 'OR', 'modifier' => '', 'func' => array('type' => 'FIND_IN_SET', 'str' => array(0 => '0', 1 => '\''), 'table' => 'pages', 'field' => 'fe_group'), 'comparator' => ''), 4 => array('operator' => 'OR', 'modifier' => '', 'func' => array('type' => 'FIND_IN_SET', 'str' => array(0 => '-1', 1 => '\''), 'table' => 'pages', 'field' => 'fe_group'), 'comparator' => '')); $output = $this->fixture->compileWhereClause($clauses); $parts = explode(' OR ', $output); $this->assertSame(count($clauses), count($parts)); $this->assertContains('IFNULL', $output); }
/** * @test * @see http://forge.typo3.org/issues/22049 */ public function canParseAndCompileBetweenOperator() { $parseString = '((scheduled BETWEEN 1265068628 AND 1265068828 ) OR scheduled <= 1265068728) AND NOT exec_time AND NOT process_id AND page_id=1 AND parameters_hash = \'854e9a2a77\''; $result = $this->subject->parseWhereClause($parseString); $this->assertInternalType('array', $result); $this->assertEmpty($parseString); $result = $this->subject->compileWhereClause($result); $expected = '((scheduled BETWEEN 1265068628 AND 1265068828) OR scheduled <= 1265068728) AND NOT exec_time AND NOT process_id AND page_id = 1 AND parameters_hash = \'854e9a2a77\''; $this->assertEquals($expected, $this->cleanSql($result)); }