Files
WP-LIT-MCP/tests/Support/FakeBuilderDetector.php

27 lines
663 B
PHP

<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Support;
use LIT\MCP\Integrations\WordPress\BuilderDetector;
/** A BuilderDetector for tests: fixed availability and a fixed set of builder layouts. */
final class FakeBuilderDetector implements BuilderDetector
{
/** @param list<int> $layouts IDs of the posts the builder flag marks. */
public function __construct(private bool $available = true, private array $layouts = [])
{
}
public function isAvailable(): bool
{
return $this->available;
}
public function usesBuilder(int $postId): bool
{
return in_array($postId, $this->layouts, true);
}
}