Migriert die weiterhin benötigten Zeitaufgaben einschließlich SOAP-Importen, Betriebsstatus und Wiederanlaufkontrolle. Aktiviert 115 native Spring-Tasks im Docker-Image ohne Cron-Daemon oder PHP und dokumentiert die entfallenen HHA-Aufrufe. Ergänzt PHP-/UI-Testwerkzeuge und aktualisiert den Projektstand auf Version 0.2.0.
45 lines
1.6 KiB
PHP
45 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class LegacyFunctionsTest extends PHPUnit\Framework\TestCase
|
|
{
|
|
public function testOnlySelectedTopLevelFunctionIsExtracted(): void
|
|
{
|
|
$source = <<<'SOURCE'
|
|
<?php
|
|
file_put_contents('/never-execute', 'startup');
|
|
// function wanted() { wrong }
|
|
class Example { function wanted() { return 'method'; } }
|
|
function unwanted() { return '}'; }
|
|
function wanted($name) { /* } */ return "{$name}: }"; }
|
|
SOURCE;
|
|
$found = LegacyFunctions::extract($source, ['wanted']);
|
|
self::assertSame(['wanted'], array_keys($found));
|
|
self::assertSame('function wanted($name) { /* } */ return "{$name}: }"; }', $found['wanted']['code']);
|
|
self::assertSame(6, $found['wanted']['line']);
|
|
}
|
|
|
|
public function testMissingFunctionFailsClosed(): void
|
|
{
|
|
$this->expectException(RuntimeException::class);
|
|
LegacyFunctions::extract('<?php function different() {}', ['wanted']);
|
|
}
|
|
|
|
public function testNestedFunctionCannotBeMistakenForGlobalDeclaration(): void
|
|
{
|
|
$this->expectException(RuntimeException::class);
|
|
LegacyFunctions::extract('<?php function outer() { function wanted() {} }', ['wanted']);
|
|
}
|
|
|
|
public function testIncludesCannotLoadApplicationBootstrap(): void
|
|
{
|
|
$this->expectException(RuntimeException::class);
|
|
LegacyFunctions::extract('<?php function wanted() { require "db.php"; }', ['wanted']);
|
|
}
|
|
|
|
public function testDuplicateDefinitionsFailClosed(): void
|
|
{
|
|
$this->expectException(RuntimeException::class);
|
|
LegacyFunctions::extract('<?php function wanted() {} function wanted() {}', ['wanted']);
|
|
}
|
|
}
|