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
+71 -1
View File
@@ -1,11 +1,15 @@
<?php
/**
* Creates or removes the Pods test content type "lit_person" for integration tests.
* Creates or removes the Pods test content type "lit_person" for integration tests, or creates the
* permanent Etappe 3b fixture pod "lit_fixture_person" with two persons (tests/Fixtures/divi/stage3b).
*
* Usage (inside DDEV, Pods must be active):
* wp eval-file wp-content/plugins/WP-LIT-MCP/tests/Integration/pods-fixture.php create
* wp eval-file wp-content/plugins/WP-LIT-MCP/tests/Integration/pods-fixture.php delete
* wp eval-file wp-content/plugins/WP-LIT-MCP/tests/Integration/pods-fixture.php fixture
*
* "delete" only removes "lit_person"; the fixture pod is kept (smokes never touch it).
*
* No strict_types: wp eval-file runs this through eval().
*/
@@ -28,6 +32,72 @@ if ($action === 'delete') {
return;
}
if ($action === 'fixture') {
// Etappe 3b fixture pod (ruling Q1): its own type, so no smoke deletes the fixture persons.
if (! $api->load_pod(['name' => 'lit_fixture_person'])) {
$api->save_pod([
'name' => 'lit_fixture_person',
'label' => '[Fixture] Personen',
'label_singular' => '[Fixture] Person',
'type' => 'post_type',
'storage' => 'meta',
'public' => 1,
'show_ui' => 1,
]);
}
$fixtureFields = [
['name' => 'role', 'label' => 'Funktion', 'type' => 'text'],
[
'name' => 'level',
'label' => 'Stufe',
'type' => 'pick',
'pick_object' => 'custom-simple',
'pick_custom' => "junior|Junior\nsenior|Senior",
],
[
'name' => 'mentor',
'label' => 'Mentor',
'type' => 'pick',
'pick_object' => 'post_type',
'pick_val' => 'lit_fixture_person',
'pick_format_type' => 'single',
],
];
foreach ($fixtureFields as $field) {
if (! $api->load_field(['pod' => 'lit_fixture_person', 'name' => $field['name']])) {
$api->save_field(array_merge(['pod' => 'lit_fixture_person'], $field));
}
}
$existing = static function (string $title): int {
$found = get_posts([
'post_type' => 'lit_fixture_person',
'post_status' => 'any',
'title' => $title,
'fields' => 'ids',
'numberposts' => 1,
]);
return (int) ($found[0] ?? 0);
};
$erika = $existing('[Fixture 3b] Erika Muster') ?: (int) pods('lit_fixture_person')->add([
'post_title' => '[Fixture 3b] Erika Muster',
'post_content' => '<p>Beitragsinhalt der Fixture-Person Erika Muster.</p>',
'post_status' => 'publish',
'role' => 'Geschäftsführung',
'level' => 'senior',
]);
$max = $existing('[Fixture 3b] Max Beispiel') ?: (int) pods('lit_fixture_person')->add([
'post_title' => '[Fixture 3b] Max Beispiel',
'post_content' => '<p>Beitragsinhalt der Fixture-Person Max Beispiel.</p>',
'post_status' => 'publish',
'role' => 'Entwicklung',
'level' => 'junior',
'mentor' => $erika,
]);
echo "persons {$erika} {$max}\n";
return;
}
if (! $api->load_pod(['name' => 'lit_person'])) {
$api->save_pod([
'name' => 'lit_person',