refactored ActiveDataProvider.

This commit is contained in:
Qiang Xue
2013-08-03 17:02:36 -04:00
parent 250ec28e0c
commit 27238f8d03
2 changed files with 36 additions and 18 deletions

View File

@@ -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()));
}
}