mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Removed duplicate assertion from tests, divided test method into two
This commit is contained in:
@ -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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user