upgrade phpunit

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

@ -14,7 +14,7 @@
}
},
"require-dev": {
"phpunit/phpunit": "^12.4",
"phpunit/phpunit": "^13",
"phpstan/phpstan": "^2.1",
"smeghead/php-class-diagram": "^1.6",
"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"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory="tests/.phpunit.cache"
executionOrder="depends,defects"
resolveDependencies="true"
requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"

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

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