Example #1
0
 public function testParseComparison()
 {
     $ast = ExpressionParser::parseComparison(ExpressionParser::lex('3 = 3'));
     $this->assertInstanceOf('Jivoo\\Data\\Query\\Expression\\Infix', $ast);
     $this->assertInstanceOf('Jivoo\\Data\\Query\\Expression\\Literal', $ast->left);
     $this->assertInstanceOf('Jivoo\\Data\\Query\\Expression\\Literal', $ast->right);
     $this->assertEquals('=', $ast->operator);
     $ast = ExpressionParser::parseComparison(ExpressionParser::lex('3 is null'));
     $this->assertInstanceOf('Jivoo\\Data\\Query\\Expression\\Infix', $ast);
     $this->assertInstanceOf('Jivoo\\Data\\Query\\Expression\\Literal', $ast->left);
     $this->assertNull($ast->right);
     $this->assertEquals('is', $ast->operator);
 }