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.
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Kartierung\Repository\ResolutionStrategy;
|
|
|
|
use Kartierung\Analyze\RepositoryMethod;
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class FindAllTest extends TestCase
|
|
{
|
|
|
|
private \PDO $pdo;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$tmpfile = tempnam(sys_get_temp_dir(), 'kartierung.sqlite');
|
|
$this->pdo = new \PDO("sqlite:/$tmpfile");
|
|
|
|
$this->pdo->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
|
|
$query = (new FindAll())->execute(
|
|
method: new RepositoryMethod(
|
|
query: '',
|
|
returnType: '',
|
|
returnListType: SimpleEntity::class,
|
|
name: '',
|
|
parameters: [],
|
|
resolutionStrategy: new FindAll()
|
|
),
|
|
parameters: []
|
|
);
|
|
|
|
// When
|
|
$result = $query->execute->__invoke($this->pdo);
|
|
|
|
// Then
|
|
$this->assertNotEmpty($result);
|
|
}
|
|
|
|
}
|