docs: Guides und Entscheidungsnotiz zur Divi-Freigabe je Fähigkeit
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
a4faeda326
commit
20ee173cd0
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
|
||||
/**
|
||||
* With a lock per feature (E1–E3) no text may say that "writing" or "Divi" as a whole is locked: only the tools of
|
||||
* the affected features refuse, every other Divi tool keeps working.
|
||||
*/
|
||||
final class FeatureTextsTest extends TestCase
|
||||
{
|
||||
private const OLD_PHRASES = [
|
||||
'Schreibende Divi-Werkzeuge sind gesperrt',
|
||||
'Schreiben ist gesperrt',
|
||||
'Schreiben bleibt gesperrt',
|
||||
'lesende Divi-Werkzeuge funktionieren weiter',
|
||||
'Divi-Werkzeuge lesen nur',
|
||||
'bis dahin lesen',
|
||||
];
|
||||
|
||||
/** @return array<string, string> Path => content of the PHP sources and the guides. */
|
||||
private static function texts(): array
|
||||
{
|
||||
$root = dirname(__DIR__, 5);
|
||||
$texts = [];
|
||||
foreach (glob($root . '/docs/guides/*.md') ?: [] as $file) {
|
||||
$texts[$file] = (string) file_get_contents($file);
|
||||
}
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root . '/src')) as $file) {
|
||||
if (str_ends_with((string) $file, '.php')) {
|
||||
$texts[(string) $file] = (string) file_get_contents((string) $file);
|
||||
}
|
||||
}
|
||||
|
||||
return $texts;
|
||||
}
|
||||
|
||||
public function testNoTextLocksWritingAsAWhole(): void
|
||||
{
|
||||
$texts = self::texts();
|
||||
self::assertNotEmpty($texts);
|
||||
|
||||
foreach ($texts as $path => $text) {
|
||||
// Join string literals split over lines ('a ' . 'b') so a phrase cannot hide in a line break.
|
||||
$text = (string) preg_replace('/\'\s*\.\s*\'/', '', $text);
|
||||
foreach (self::OLD_PHRASES as $phrase) {
|
||||
self::assertFalse(
|
||||
stripos($text, $phrase) !== false,
|
||||
sprintf('%s still says "%s" – name the feature instead', basename($path), $phrase)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user