feat: lit-site-status, Admin-Tab und Admin-Hinweis zeigen Divi-Fähigkeiten mit Zustand, Quelle, Problemen und betroffenen Werkzeugen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
b92545a8fe
commit
2aef6e1154
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Support;
|
||||
|
||||
use LIT\MCP\Abilities\Ability;
|
||||
use LIT\MCP\Integrations\Divi\Release\RequiresDiviFeatures;
|
||||
use WP_Error;
|
||||
|
||||
/** A tool that needs the given Divi features – for the feature overview, the tab and site status. */
|
||||
final class FeatureFakeTool implements Ability, RequiresDiviFeatures
|
||||
{
|
||||
/** @param list<\LIT\MCP\Integrations\Divi\Release\DiviFeature> $features */
|
||||
public function __construct(
|
||||
private string $name,
|
||||
private bool $direct,
|
||||
private array $features
|
||||
) {
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function inputSchema(): array
|
||||
{
|
||||
return ['type' => 'object'];
|
||||
}
|
||||
|
||||
public function outputSchema(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function annotations(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function isDirect(): bool
|
||||
{
|
||||
return $this->direct;
|
||||
}
|
||||
|
||||
public function permission(array $input): bool|WP_Error
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function execute(array $input): mixed
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function diviFeatures(array $input): array
|
||||
{
|
||||
return $this->features;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Support;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Release\CompatibilityMatrix;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
|
||||
use LIT\MCP\Integrations\Divi\Release\FeatureStatus;
|
||||
use LIT\MCP\Integrations\Divi\Release\ReleaseState;
|
||||
|
||||
/** Compatibility matrices for tests: every feature released, with single features replaced. */
|
||||
final class MatrixFixtures
|
||||
{
|
||||
/**
|
||||
* @param list<FeatureStatus> $replace Statuses that replace the released one of their feature.
|
||||
*/
|
||||
public static function released(string $source = 'code', array $replace = []): CompatibilityMatrix
|
||||
{
|
||||
$features = [];
|
||||
foreach (DiviFeature::cases() as $feature) {
|
||||
$features[$feature->value] = new FeatureStatus($feature, ReleaseState::Released, [], $source);
|
||||
}
|
||||
foreach ($replace as $status) {
|
||||
$features[$status->feature->value] = $status;
|
||||
}
|
||||
|
||||
return new CompatibilityMatrix($features);
|
||||
}
|
||||
|
||||
/** @param string ...$problems */
|
||||
public static function with(
|
||||
DiviFeature $feature,
|
||||
ReleaseState $state,
|
||||
string $source = 'code',
|
||||
string ...$problems
|
||||
): CompatibilityMatrix {
|
||||
return self::released($source, [new FeatureStatus($feature, $state, $problems, null)]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user