mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 02:13:17 +08:00
adjusted tests
This commit is contained in:
@ -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', '']]]);
|
||||
|
||||
Reference in New Issue
Block a user