adjusted tests

This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
Carsten Brandt
2014-04-02 18:56:49 +02:00
gitea-unlock(16/)
parent 51eabf527f
commit c572c23c2f
octicon-diff(16/tw-mr-1) 4 changed files with 31 additions and 31 deletions

6
tests/unit/extensions/elasticsearch/QueryTest.php
View File

@@ -151,7 +151,7 @@ class QueryTest extends ElasticSearchTestCase
} }
public function testFilter() public function testFilterWhere()
{ {
// should work with hash format // should work with hash format
$query = new Query; $query = new Query;
@@ -162,10 +162,10 @@ class QueryTest extends ElasticSearchTestCase
]); ]);
$this->assertEquals(['id' => 0], $query->where); $this->assertEquals(['id' => 0], $query->where);
$query->andFilter(['status' => null]); $query->andFilterWhere(['status' => null]);
$this->assertEquals(['id' => 0], $query->where); $this->assertEquals(['id' => 0], $query->where);
$query->orFilter(['name' => '']); $query->orFilterWhere(['name' => '']);
$this->assertEquals(['id' => 0], $query->where); $this->assertEquals(['id' => 0], $query->where);
} }

6
tests/unit/extensions/mongodb/QueryTest.php
View File

@@ -68,7 +68,7 @@ class QueryTest extends MongoDbTestCase
); );
} }
public function testFilter() public function testFilterWhere()
{ {
// should work with hash format // should work with hash format
$query = new Query; $query = new Query;
@@ -79,10 +79,10 @@ class QueryTest extends MongoDbTestCase
]); ]);
$this->assertEquals(['id' => 0], $query->where); $this->assertEquals(['id' => 0], $query->where);
$query->andFilter(['status' => null]); $query->andFilterWhere(['status' => null]);
$this->assertEquals(['id' => 0], $query->where); $this->assertEquals(['id' => 0], $query->where);
$query->orFilter(['name' => '']); $query->orFilterWhere(['name' => '']);
$this->assertEquals(['id' => 0], $query->where); $this->assertEquals(['id' => 0], $query->where);
} }

26
tests/unit/extensions/sphinx/QueryTest.php
View File

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

24
tests/unit/framework/db/QueryTest.php
View File

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