Files
KantSites/tests/ReleaseOnDisk.php
T
kantarciandClaude Opus 5 c8a8fa7460 Rebuild DEEG as a fifth installation, add stepped forms and a plugin system, and clear the review backlog
Forms gained steps, conditions, image choices, number fields with units and a
summary step; the DEEG price finder uses all of it. Plugins are manifest plus
Twig: blocks, settings, containers, routes, presets and theme packs, switched
per installation. The review backlog is done: archive pages render through the
normal page pipeline, forms and post lists work inside areas and sections,
repeated sections get their own ids, breakpoints and colours come from the
palette, backup and update work on MySQL and lock each other out.

The task worker no longer shortens a process that has no time limit:
set_time_limit() sets the limit instead of extending it, which turned an
unlimited CLI run into eighty seconds and killed the full test suite far away
from the scheduler.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 07:32:35 +02:00

58 lines
1.9 KiB
PHP

<?php
namespace App\Tests;
use App\Ops\Download;
/**
* Eine Releaseseite, die im Dateisystem liegt statt im Netz.
*
* Ein Test, der wirklich nach git.kant-it.de greift, prüft die Leitung und nicht den Updater: er
* schlägt fehl, wenn der Server umzieht, und er ist grün, wenn im Archiv Unsinn steht. Diese
* Attrappe beantwortet dieselben drei Adressen - Releaseliste, Archiv, Prüfsumme - aus dem
* Speicher und merkt sich, was abgefragt wurde.
*/
final class ReleaseOnDisk extends Download
{
/** @var array<string, string> */
private array $antworten = [];
/** @var list<string> */
public array $abgefragt = [];
public function serve(string $url, string $inhalt): void
{
$this->antworten[$url] = $inhalt;
}
/** Legt ein vollständiges Release ab: Releaseliste, Archiv und Prüfsumme. */
public function release(string $base, string $api, string $version, string $archiv, ?string $checksum = null): void
{
$this->serve($api.'/releases/latest', json_encode(['tag_name' => 'v'.$version], JSON_THROW_ON_ERROR));
$this->serve(sprintf('%s/v%s/kantsites-%s.zip', $base, $version, $version), $archiv);
$this->serve(sprintf('%s/v%s/kantsites-%s.zip.sha256', $base, $version, $version), sprintf(
"%s kantsites-%s.zip\n",
$checksum ?? hash('sha256', $archiv),
$version,
));
}
public function get(string $url): ?string
{
$this->abgefragt[] = $url;
return $this->antworten[$url] ?? null;
}
/** Wie get(), nur in eine Datei - der Updater laedt das Archiv so, ohne es in den Speicher zu nehmen. */
public function toFile(string $url, string $path): bool
{
$inhalt = $this->get($url);
if (null === $inhalt) {
return false;
}
return false !== file_put_contents($path, $inhalt);
}
}