public function testHasQueryTerm() { $this->query->parse('@year 1999'); $term1999 = QueryTerm::fromString('@year 1999'); $term1974 = QueryTerm::fromString('@year 1974'); $this->assertTrue($this->query->hasQueryTerm('@year 1999')); $this->assertTrue($this->query->hasQueryTerm($term1999)); $this->assertFalse($this->query->hasQueryTerm('@year 1974')); $this->assertFalse($this->query->hasQueryTerm($term1974)); }
public function testConstructFromString() { $this->term = QueryTerm::fromString(''); $this->assertEquals(null, $this->term); $this->term = QueryTerm::fromString(' '); $this->assertEquals(null, $this->term); $this->term = QueryTerm::fromString('@+* drama'); $this->assertEquals('(@* drama)', $this->term->__toString()); $this->term = QueryTerm::fromString('@-keyword horror '); $this->assertEquals('(@-keyword horror)', $this->term->__toString()); $this->term = QueryTerm::fromString('@ horror'); $this->assertEquals('(@* horror)', $this->term->__toString()); $this->term = QueryTerm::fromString('@keyword Drama', array('keyword' => 'plot_keywords'), array('keyword' => 'plot_keyword_attr')); $this->assertEquals('(@keyword Drama)', $this->term->__toString()); $this->assertEquals('(@plot_keywords drama)', $this->term->toCanonical()); }