Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Unit\Integrations\WordPress\Schema;
|
|
|
|
use LIT\MCP\Integrations\WordPress\Schema\FieldDefinition;
|
|
use LIT\MCP\Integrations\WordPress\Schema\SampledMetaSource;
|
|
use LIT\MCP\Tests\Unit\TestCase;
|
|
use Mockery;
|
|
|
|
final class SampledMetaSourceTest extends TestCase
|
|
{
|
|
public function testReturnsVisibleKeysOfRecentPostsAsUnknown(): void
|
|
{
|
|
$db = Mockery::mock(\wpdb::class)->makePartial();
|
|
$db->expects('get_col')
|
|
->with(Mockery::on(static fn (string $sql): bool => str_contains($sql, "post_type = 'lit_person'")
|
|
&& str_contains($sql, 'LIMIT 50')))
|
|
->andReturn(['_edit_lock', 'city', 'role']);
|
|
|
|
$fields = (new SampledMetaSource($db))->fieldsFor('lit_person');
|
|
|
|
self::assertSame(['city', 'role'], array_map(static fn (FieldDefinition $f): string => $f->key, $fields));
|
|
self::assertSame(FieldDefinition::UNKNOWN, $fields[0]->status);
|
|
self::assertSame('sample', $fields[0]->source);
|
|
self::assertSame('unknown', $fields[0]->type);
|
|
}
|
|
}
|