Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
48 lines
1.6 KiB
PHP
48 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Unit\Integrations\Core;
|
|
|
|
use Brain\Monkey\Functions;
|
|
use LIT\MCP\Integrations\Core\EnvironmentProbe;
|
|
use LIT\MCP\Integrations\Divi\DiviCompatibility;
|
|
use LIT\MCP\Tests\Unit\TestCase;
|
|
use Mockery;
|
|
|
|
final class EnvironmentProbeTest extends TestCase
|
|
{
|
|
public function testDiviComponentCarriesTheCompatibilityFindings(): void
|
|
{
|
|
$theme = Mockery::mock();
|
|
$theme->allows('get_template')->andReturn('Divi');
|
|
$theme->allows('parent')->andReturn(false);
|
|
$theme->allows('get')->with('Version')->andReturn('5.2.1');
|
|
Functions\when('wp_get_theme')->justReturn($theme);
|
|
|
|
$probe = new EnvironmentProbe(new DiviCompatibility(['GlobalLayout' => static fn (): bool => false]));
|
|
$components = array_column($probe->components(), null, 'id');
|
|
|
|
self::assertSame(['GlobalLayout'], $components['divi']['problems']);
|
|
self::assertSame([], $components['pods']['problems']);
|
|
}
|
|
|
|
public function testDiviComponentCarriesTheReleaseStatus(): void
|
|
{
|
|
$theme = Mockery::mock();
|
|
$theme->allows('get_template')->andReturn('Divi');
|
|
$theme->allows('parent')->andReturn(false);
|
|
$theme->allows('get')->with('Version')->andReturn('5.2.1');
|
|
Functions\when('wp_get_theme')->justReturn($theme);
|
|
|
|
$components = array_column(
|
|
(new EnvironmentProbe(new DiviCompatibility([])))->components(),
|
|
null,
|
|
'id'
|
|
);
|
|
|
|
self::assertSame('released', $components['divi']['release']['state'] ?? null);
|
|
self::assertNull($components['pods']['release'] ?? null);
|
|
}
|
|
}
|