test: Theme Builder fixtures with Pods fields from the real builder (stage3b)

Own fixture pod lit_fixture_person (ruling Q1), template and body layout
built through Divi's Theme Builder and Visual Builder UI, brief render with
the template limited to one person (Q5), findings 10-12 in the README.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 14:51:19 +02:00
co-authored by Claude Opus 5.5
parent 0edb474d78
commit c615522cf6
15 changed files with 494 additions and 7 deletions
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\BlockTree;
use LIT\MCP\Integrations\Divi\BlockTree\Parser;
use LIT\MCP\Integrations\Divi\BlockTree\Serializer;
use LIT\MCP\Tests\Support\DiviFixtures;
use PHPUnit\Framework\TestCase;
/** The Etappe 3b builder fixtures (tests/Fixtures/divi/stage3b, README): real Divi data with Pods fields. */
final class Stage3bFixturesTest extends TestCase
{
/** @return array<string, array{string}> */
public static function files(): array
{
$files = glob(dirname(__DIR__, 4) . '/Fixtures/divi/stage3b/*.html') ?: [];
$cases = [];
foreach ($files as $file) {
$cases[basename($file)] = ['stage3b/' . basename($file)];
}
return $cases;
}
public function testTheFixturesExist(): void
{
self::assertArrayHasKey('tb-body--person-body.html', self::files());
self::assertFileExists(dirname(__DIR__, 4) . '/Fixtures/divi/stage3b/tb-template--person.json');
}
/** @dataProvider files */
public function testParsesAndSerializesByteIdentically(string $name): void
{
$content = DiviFixtures::markup($name);
self::assertSame($content, Serializer::document((new Parser())->parse($content)));
}
/** Finding 12: the Pods field "role" as Divi's dialog writes it (custom_meta_role or post_meta_key + meta_key). */
public function testBodyLayoutShowsThePodsFieldRole(): void
{
$body = DiviFixtures::markup('stage3b/tb-body--person-body.html');
self::assertTrue(
str_contains($body, 'custom_meta_role') || str_contains($body, 'meta_key":"role"'),
'the body layout references the Pods field role'
);
self::assertStringContainsString('wp:divi/post-content', $body);
}
public function testTheTemplateIsDisabledAndMeantForPersons(): void
{
$template = json_decode(DiviFixtures::markup('stage3b/tb-template--person.json'), true);
self::assertSame(['0'], $template['meta']['_et_enabled']);
self::assertSame(['singular:post_type:lit_fixture_person:all'], $template['meta']['_et_use_on']);
self::assertSame(['1061'], $template['meta']['_et_header_layout_id'], 'global header of the default template');
}
}