refactor: Kern ohne Divi – Ports BuilderDetector, MediaUsageSource, EnvironmentComponent und ausgeschlossene Post-Typen im ContentSchema; Divi-Implementierungen und Verdrahtung über DiviIntegration/Plugin; CoreIndependenceTest

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-18 21:49:28 +02:00
co-authored by Claude Sonnet 5.5
parent abeb4b0eed
commit 06148fb8c1
33 changed files with 952 additions and 154 deletions
@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi;
use Brain\Monkey\Functions;
use LIT\MCP\Integrations\Core\EnvironmentComponent;
use LIT\MCP\Integrations\Divi\DiviCompatibility;
use LIT\MCP\Integrations\Divi\DiviEnvironmentComponent;
use LIT\MCP\Tests\Unit\TestCase;
use Mockery;
final class DiviEnvironmentComponentTest extends TestCase
{
private function theme(string $template, string $version = '5.2.1'): void
{
$theme = Mockery::mock();
$theme->allows('get_template')->andReturn($template);
$theme->allows('parent')->andReturn(false);
$theme->allows('get')->with('Version')->andReturn($version);
Functions\when('wp_get_theme')->justReturn($theme);
}
public function testIsAnEnvironmentComponent(): void
{
self::assertInstanceOf(EnvironmentComponent::class, new DiviEnvironmentComponent());
}
public function testCarriesTheCompatibilityFindings(): void
{
$this->theme('Divi');
$component = new DiviEnvironmentComponent(
new DiviCompatibility(['GlobalLayout' => static fn (): bool => false])
);
$described = $component->describe();
self::assertSame('divi', $described['id']);
self::assertTrue($described['active']);
self::assertSame('5.2.1', $described['version']);
self::assertSame(['GlobalLayout'], $described['problems']);
}
public function testCarriesTheReleaseStatus(): void
{
$this->theme('Divi');
$described = (new DiviEnvironmentComponent(new DiviCompatibility([])))->describe();
self::assertSame([], $described['problems']);
self::assertSame('released', $described['release']['state'] ?? null);
}
public function testIsInactiveWithoutDiviAndHasNoProblemsOrRelease(): void
{
$this->theme('twentytwentysix', '1.0');
$described = (new DiviEnvironmentComponent(
new DiviCompatibility(['GlobalLayout' => static fn (): bool => false])
))->describe();
self::assertSame(
['id' => 'divi', 'active' => false, 'version' => null, 'problems' => [], 'release' => null],
$described
);
}
}