From b78d6367ba454e71a6dffd752ae29683a3203206 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 15 Dec 2016 18:02:25 +0300 Subject: [PATCH] Removed duplicate assertion from tests, divided test method into two --- tests/framework/db/QueryTest.php | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/framework/db/QueryTest.php b/tests/framework/db/QueryTest.php index a7db8628f2..4ade380dd5 100644 --- a/tests/framework/db/QueryTest.php +++ b/tests/framework/db/QueryTest.php @@ -56,9 +56,8 @@ abstract class QueryTest extends DatabaseTestCase $this->assertEquals([':id' => 1, ':name' => 'something', ':age' => '30'], $query->params); } - public function testFilterWhere() + public function testFilterWhereWithHashFormat() { - // should work with hash format $query = new Query; $query->filterWhere([ 'id' => 0, @@ -72,8 +71,10 @@ abstract class QueryTest extends DatabaseTestCase $query->orFilterWhere(['name' => '']); $this->assertEquals(['id' => 0], $query->where); + } - // should work with operator format + public function testFilterWhereWithOperatorFormat() + { $query = new Query; $condition = ['like', 'name', 'Alex']; $query->filterWhere($condition); @@ -91,9 +92,6 @@ abstract class QueryTest extends DatabaseTestCase $query->andFilterWhere(['not in', 'id', []]); $this->assertEquals($condition, $query->where); - $query->andFilterWhere(['not in', 'id', []]); - $this->assertEquals($condition, $query->where); - $query->andFilterWhere(['like', 'id', '']); $this->assertEquals($condition, $query->where); @@ -110,9 +108,8 @@ abstract class QueryTest extends DatabaseTestCase $this->assertEquals($condition, $query->where); } - public function testFilterHaving() + public function testFilterHavingWithHashFormat() { - // should work with hash format $query = new Query; $query->filterHaving([ 'id' => 0, @@ -126,8 +123,10 @@ abstract class QueryTest extends DatabaseTestCase $query->orFilterHaving(['name' => '']); $this->assertEquals(['id' => 0], $query->having); + } - // should work with operator format + public function testFilterHavingWithOperatorFormat() + { $query = new Query; $condition = ['like', 'name', 'Alex']; $query->filterHaving($condition); @@ -145,9 +144,6 @@ abstract class QueryTest extends DatabaseTestCase $query->andFilterHaving(['not in', 'id', []]); $this->assertEquals($condition, $query->having); - $query->andFilterHaving(['not in', 'id', []]); - $this->assertEquals($condition, $query->having); - $query->andFilterHaving(['like', 'id', '']); $this->assertEquals($condition, $query->having); @@ -326,7 +322,8 @@ abstract class QueryTest extends DatabaseTestCase } /** - * @depends testFilterWhere + * @depends testFilterWhereWithHashFormat + * @depends testFilterWhereWithOperatorFormat */ public function testAndFilterCompare() {