Changed namespaces and added Query Builder

Co-authored-by: Juan Pablo Vial <jpvial@goacegroup.com>
Reviewed-on: #2
This commit is contained in:
2025-09-30 17:34:06 -03:00
parent 1bd3ccb8db
commit f6937c3aee
29 changed files with 555 additions and 178 deletions

26
tests/ResultSetTest.php Normal file
View File

@ -0,0 +1,26 @@
<?php
use PHPUnit\Framework\TestCase;
use Database\Implement\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());
}
}