Yii2 Bootstrap 3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
992 B

<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\framework\data;
use yii\data\ActiveDataProvider;
use yiiunit\data\ar\ActiveRecord;
use yiiunit\framework\db\DatabaseTestCase;
use yiiunit\data\ar\Order;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class ActiveDataProviderTest extends DatabaseTestCase
{
protected function setUp()
{
parent::setUp();
ActiveRecord::$db = $this->getConnection();
}
public function testActiveQuery()
{
$provider = new ActiveDataProvider(array(
'query' => Order::find(),
));
$orders = $provider->getItems();
$this->assertEquals(3, count($orders));
$provider = new ActiveDataProvider(array(
'query' => Order::find(),
'pagination' => array(
'pageSize' => 2,
)
));
$orders = $provider->getItems();
$this->assertEquals(2, count($orders));
}
public function testQuery()
{
}
}