Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Support;
|
|
|
|
use LIT\MCP\Integrations\Divi\Library\GlobalUsages;
|
|
use LIT\MCP\Integrations\Divi\Library\UsageReport;
|
|
use Mockery;
|
|
use Mockery\MockInterface;
|
|
|
|
/** GlobalUsages stand-ins for the design planners (audit L4). */
|
|
final class UsageFixture
|
|
{
|
|
/** Nothing uses anything. */
|
|
public static function none(): GlobalUsages&MockInterface
|
|
{
|
|
return self::reporting(new UsageReport(0, [], 0, 0, [], 0, false));
|
|
}
|
|
|
|
/** Live post 7 uses everything and the caller may not edit it (ruling P8a). */
|
|
public static function blocked(): GlobalUsages&MockInterface
|
|
{
|
|
return self::reporting(self::blockedReport());
|
|
}
|
|
|
|
public static function blockedReport(): UsageReport
|
|
{
|
|
return new UsageReport(
|
|
1,
|
|
[['post_id' => 7, 'title' => 'Start', 'status' => 'publish', 'type' => 'page']],
|
|
0,
|
|
1,
|
|
[7],
|
|
0,
|
|
false
|
|
);
|
|
}
|
|
|
|
public static function reporting(UsageReport $report): GlobalUsages&MockInterface
|
|
{
|
|
$usages = Mockery::mock(GlobalUsages::class);
|
|
$usages->allows('reportFor')->andReturn($report);
|
|
|
|
return $usages;
|
|
}
|
|
}
|