Sam Mousa
8 years ago
committed by
Alexander Makarov
3 changed files with 38 additions and 1 deletions
@ -0,0 +1,35 @@
|
||||
<?php |
||||
|
||||
namespace yiiunit\framework\data; |
||||
|
||||
use yii\data\ArrayDataProvider; |
||||
use yii\data\SqlDataProvider; |
||||
use yiiunit\framework\db\DatabaseTestCase; |
||||
use yiiunit\framework\db\sqlite\ConnectionTest; |
||||
use yiiunit\TestCase; |
||||
|
||||
/** |
||||
* @group data |
||||
*/ |
||||
class SqlDataProviderTest extends DatabaseTestCase |
||||
{ |
||||
protected $driverName = 'sqlite'; |
||||
|
||||
public function testGetModels() |
||||
{ |
||||
$dataProvider = new SqlDataProvider([ |
||||
'sql' => 'select * from `customer`', |
||||
'db' => $this->getConnection(), |
||||
]); |
||||
$this->assertCount(3, $dataProvider->getModels()); |
||||
} |
||||
|
||||
public function testTotalCount() |
||||
{ |
||||
$dataProvider = new SqlDataProvider([ |
||||
'sql' => 'select * from `customer`', |
||||
'db' => $this->getConnection(), |
||||
]); |
||||
$this->assertEquals(3, $dataProvider->getTotalCount()); |
||||
} |
||||
} |
Loading…
Reference in new issue