Neu: Tier, Profile, Compatibility, CapabilityLocked, CapabilityGate, CompatibilityComponent, ProvidesCompatibility, DiviProfile sowie PodsFeature, PodsCompatibility und PodsIntegration. Das CapabilityGate sperrt gesperrte und unbekannte Fähigkeits-IDs (übernimmt die Sperre unbekannter IDs vom DiviFeatureGate) und delegiert nur Divi ausdrücklich. Pods-Schema, -Lesen, -Schreiben und -Feldrechte laufen über usable(PodsFeature::…); Schreiben verlangt FieldRead und FieldWrite, damit ein Rollback keine Werte verliert. lit-site-status meldet Pods über die CompatibilityComponent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.6 KiB
PHP
46 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\CoreIntegration;
|
|
use LIT\MCP\Integrations\Core\EnvironmentComponent;
|
|
use LIT\MCP\Tests\Unit\TestCase;
|
|
use WP_User;
|
|
|
|
final class CoreIntegrationTest extends TestCase
|
|
{
|
|
public function testIsAlwaysAvailableAndProvidesGuideAndStatus(): void
|
|
{
|
|
$core = new CoreIntegration(dirname(__DIR__, 3) . '/Fixtures/guides');
|
|
|
|
self::assertSame('core', $core->id());
|
|
self::assertTrue($core->isAvailable());
|
|
self::assertSame(
|
|
['lit/guide', 'lit/site-status'],
|
|
array_map(static fn ($a) => $a->name(), $core->abilities())
|
|
);
|
|
}
|
|
|
|
public function testSiteStatusReportsTheComponentsOfTheIntegrations(): void
|
|
{
|
|
Functions\when('get_bloginfo')->justReturn('x');
|
|
Functions\when('home_url')->justReturn('https://kunde.de');
|
|
Functions\when('wp_get_current_user')->justReturn(new WP_User(3, ['editor']));
|
|
Functions\when('get_option')->justReturn(['editor']);
|
|
$component = new class implements EnvironmentComponent {
|
|
public function describe(): array
|
|
{
|
|
return ['id' => 'builder', 'active' => true, 'version' => '9', 'problems' => [], 'release' => null];
|
|
}
|
|
};
|
|
$core = new CoreIntegration(dirname(__DIR__, 3) . '/Fixtures/guides', static fn (): array => [$component]);
|
|
|
|
$status = $core->abilities()[1]->execute([]);
|
|
|
|
self::assertSame(['builder', 'the-events-calendar'], array_column($status['components'], 'id'));
|
|
}
|
|
}
|