mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-29 22:21:33 +08:00
refactored ActiveDataProvider.
This commit is contained in:
@@ -68,4 +68,19 @@ class ActiveDataProviderTest extends DatabaseTestCase
|
||||
$orders = $provider->getModels();
|
||||
$this->assertEquals(2, count($orders));
|
||||
}
|
||||
|
||||
public function testRefresh()
|
||||
{
|
||||
$query = new Query;
|
||||
$provider = new ActiveDataProvider(array(
|
||||
'db' => $this->getConnection(),
|
||||
'query' => $query->from('tbl_order')->orderBy('id'),
|
||||
));
|
||||
$this->assertEquals(3, count($provider->getModels()));
|
||||
|
||||
$provider->getPagination()->pageSize = 2;
|
||||
$this->assertEquals(3, count($provider->getModels()));
|
||||
$provider->refresh();
|
||||
$this->assertEquals(2, count($provider->getModels()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user