upgrade phpunit

master
Josha von Gizycki 1 week ago
parent 3a5a4c7a5c
commit ff8b022454

@ -14,7 +14,7 @@
} }
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^12.4", "phpunit/phpunit": "^13",
"phpstan/phpstan": "^2.1", "phpstan/phpstan": "^2.1",
"smeghead/php-class-diagram": "^1.6", "smeghead/php-class-diagram": "^1.6",
"ext-pdo_sqlite": "*", "ext-pdo_sqlite": "*",

886
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory="tests/.phpunit.cache" cacheDirectory="tests/.phpunit.cache"
executionOrder="depends,defects" resolveDependencies="true"
requireCoverageMetadata="false" requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="true" beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true" beStrictAboutOutputDuringTests="true"

@ -8,17 +8,13 @@ use Kartierung\Analyze\Result\RepositoryMethod;
use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class FindAllTest extends TestCase class FindAllTest extends SqliteBaseCase
{ {
private \PDO $pdo;
protected function setUp(): void protected function setUp(): void
{ {
$tmpfile = tempnam(sys_get_temp_dir(), 'kartierung.sqlite'); parent::setUp();
$this->pdo = new \PDO("sqlite:/$tmpfile");
$this->pdo->exec( $this->getPdo()->exec(
" "
CREATE TABLE SimpleEntity ( CREATE TABLE SimpleEntity (
stringcol VARCHAR(250), stringcol VARCHAR(250),
@ -35,20 +31,18 @@ class FindAllTest extends TestCase
public function testSelectsData(): void public function testSelectsData(): void
{ {
// Given // Given
$query = (new FindAll())->createQuery( $method = new RepositoryMethod(
method: new RepositoryMethod( query: '',
query: '', returnType: '',
returnType: '', returnListType: SimpleEntity::class,
returnListType: SimpleEntity::class, name: '',
name: '', parameters: [],
parameters: [], resolutionStrategy: new FindAll()
resolutionStrategy: new FindAll()
),
parameters: []
); );
$query = $method->createQuery([]);
// When // When
$result = $query->execute($this->pdo); $result = $query->execute($this->getPdo());
// Then // Then
$this->assertNotEmpty($result); $this->assertNotEmpty($result);

@ -34,12 +34,12 @@ class ResolutionStrategyFactoryTest extends TestCase
{ {
// When // When
$function = (new ResolutionStrategyFactory())->forRepositoryMethod( $function = (new ResolutionStrategyFactory())->forRepositoryMethod(
$repName, repName: $repName,
$name, methodName: $name,
$query, query: $query,
$returnType, returnType: $returnType,
$listType, listType: $listType,
$params params: $params
); );
// Then // Then

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Kartierung\Repository\ResolutionStrategy;
use PDO;
use PHPUnit\Framework\TestCase;
abstract class SqliteBaseCase extends TestCase
{
private PDO $pdo;
protected function setUp(): void
{
parent::setUp();
$tmpfile = tempnam(sys_get_temp_dir(), 'kartierung.sqlite');
$this->pdo = new \PDO("sqlite:/$tmpfile");
}
protected function getPdo(): PDO
{
return $this->pdo;
}
}
Loading…
Cancel
Save