adjusted tests

This commit is contained in:
Carsten Brandt
2014-04-02 18:56:49 +02:00
parent 51eabf527f
commit c572c23c2f
4 changed files with 31 additions and 31 deletions

View File

@ -60,7 +60,7 @@ class QueryTest extends SphinxTestCase
$this->assertEquals([':id' => 1, ':name' => 'something', ':age' => '30'], $query->params);
}
public function testFilter()
public function testFilterWhere()
{
// should just call where() when string is passed
$query = new Query;
@ -77,10 +77,10 @@ class QueryTest extends SphinxTestCase
]);
$this->assertEquals(['id' => 0], $query->where);
$query->andFilter(['status' => null]);
$query->andFilterWhere(['status' => null]);
$this->assertEquals(['id' => 0], $query->where);
$query->orFilter(['name' => '']);
$query->orFilterWhere(['name' => '']);
$this->assertEquals(['id' => 0], $query->where);
// should work with operator format
@ -89,35 +89,35 @@ class QueryTest extends SphinxTestCase
$query->filterWhere($condition);
$this->assertEquals($condition, $query->where);
$query->andFilter(['between', 'id', null, null]);
$query->andFilterWhere(['between', 'id', null, null]);
$this->assertEquals($condition, $query->where);
$query->orFilter(['not between', 'id', null, null]);
$query->orFilterWhere(['not between', 'id', null, null]);
$this->assertEquals($condition, $query->where);
$query->andFilter(['in', 'id', []]);
$query->andFilterWhere(['in', 'id', []]);
$this->assertEquals($condition, $query->where);
$query->andFilter(['not in', 'id', []]);
$query->andFilterWhere(['not in', 'id', []]);
$this->assertEquals($condition, $query->where);
$query->andFilter(['not in', 'id', []]);
$query->andFilterWhere(['not in', 'id', []]);
$this->assertEquals($condition, $query->where);
$query->andFilter(['like', 'id', '']);
$query->andFilterWhere(['like', 'id', '']);
$this->assertEquals($condition, $query->where);
$query->andFilter(['or like', 'id', '']);
$query->andFilterWhere(['or like', 'id', '']);
$this->assertEquals($condition, $query->where);
$query->andFilter(['not like', 'id', ' ']);
$query->andFilterWhere(['not like', 'id', ' ']);
$this->assertEquals($condition, $query->where);
$query->andFilter(['or not like', 'id', null]);
$query->andFilterWhere(['or not like', 'id', null]);
$this->assertEquals($condition, $query->where);
}
public function testFilterRecursively()
public function testFilterWhereRecursively()
{
$query = new Query();
$query->filterWhere(['and', ['like', 'name', ''], ['like', 'title', ''], ['id' => 1], ['not', ['like', 'name', '']]]);