CodeSafeGetTest.php
Pfad: tests/CodeSafeGetTest.php
Ext: php
Größe: 1175 Bytes
Geändert: 2026-07-16 17:01:22+02
<?php
declare(strict_types=1);
namespace Tests;
use Demo\Application\Code\SynchronisiereCodeDateien;
use Demo\Infrastructure\Code\CodeDateiScanner;
use Demo\Infrastructure\Http\CodeDetailAction;
use Demo\Infrastructure\Http\CodeListeAction;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use ReflectionParameter;
/**
* Sichert, dass lesende Code-Actions keine Synchronisationsadapter besitzen.
*/
final class CodeSafeGetTest extends TestCase
{
/** Code-GET-Konstruktoren duerfen weder Scanner noch Sync injizieren. */
public function testCodeGetActionsSindReadOnlyKomponiert(): void
{
foreach ([CodeListeAction::class, CodeDetailAction::class] as $action) {
$constructor = (new ReflectionClass($action))->getConstructor();
self::assertNotNull($constructor);
$types = array_map(
static fn (ReflectionParameter $parameter): string => (string) $parameter->getType(),
$constructor->getParameters()
);
self::assertNotContains(CodeDateiScanner::class, $types);
self::assertNotContains(SynchronisiereCodeDateien::class, $types);
}
}
}