public function testTostring() { $oGroup = new sequin\Query(new sequin\Term('foo')); $oGroup->andRight(new sequin\Term('bar')); $this->assertEquals('(foo) AND bar', $oGroup->toString()); $oLeftTerm = new sequin\Term('foo'); $oLeftTerm->andRight(new sequin\Term('bar')); $oGroup = new sequin\Query($oLeftTerm); $oGroup->orRight(new sequin\Term('baz')); $this->assertEquals('(foo AND bar) OR baz', $oGroup->toString()); $oLeftTerm = new sequin\Term('foo'); $oLeftTerm->andRight(new sequin\Term('bar')); $oGroup = new sequin\Query($oLeftTerm, 'fieldName', 3); $oGroup->orRight(new sequin\Term('baz')); $this->assertEquals('fieldName:(foo AND bar)^3 OR baz', $oGroup->toString()); }
public function testTermsCanBeJoinedByChainingMethodCalls() { $oTerm = new sequin\Term('foo'); $oTerm->andRight(new sequin\Term('bar'))->orRight(new sequin\Term('baz'))->notRight(new sequin\Term('bip')); $this->assertEquals('foo AND bar OR baz NOT bip', $oTerm->toString()); }