27 lines
829 B
PHP
27 lines
829 B
PHP
<?php
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use ProVM\Database\ResultSet;
|
|
|
|
class ResultSetTest extends TestCase
|
|
{
|
|
public function testResultSet()
|
|
{
|
|
$result1 = ['col1', 'col2', 'col3'];
|
|
$result2 = [['col1', 'col2'], ['col3', 'col4']];
|
|
|
|
$statement = $this->getMockBuilder(PDOStatement::class)->getMock();
|
|
$statement->method('execute')->willReturn(true);
|
|
$statement->method('fetch')->willReturn($result1);
|
|
$statement->method('fetchAll')->willReturn($result2);
|
|
$statement->method('rowCount')->willReturn(2);
|
|
|
|
$resultSet = new ResultSet($statement);
|
|
|
|
$resultSet->execute(['foo' => 'bar']);
|
|
$this->assertTrue(true);
|
|
$this->assertEquals($result1, $resultSet->fetchFirst());
|
|
$this->assertEquals($result2, $resultSet->fetchAll());
|
|
}
|
|
}
|