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

59 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Kartierung\Repository\ResolutionStrategy;
use Kartierung\Analyze\Result\RepositoryMethod;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
class FindAllTest extends SqliteBaseCase
{
protected function setUp(): void
{
parent::setUp();
$this->getPdo()->exec(
"
CREATE TABLE SimpleEntity (
stringcol VARCHAR(250),
intcol INT
);
INSERT INTO SimpleEntity(stringcol, intcol)
VALUES ('dings', 1),
('bumms', 2);
"
);
}
#[Group('integration')]
public function testSelectsData(): void
{
// Given
$method = new RepositoryMethod(
query: '',
returnType: '',
returnsNullable: true,
returnListType: SimpleEntity::class,
name: '',
parameters: []
);
$query = (new FindAll())->createQuery($method, []);
// When
$result = $query->execute($this->getPdo());
// Then
$this->assertNotEmpty($result);
$this->assertEquals(
[
new SimpleEntity(1, 'dings'),
new SimpleEntity(2, 'bumms')
],
$result
);
}
}