test: lit-content-create hat keinen Schleifen-Kontext – loop_* mit der Schleifen-Meldung abgelehnt (X3)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-19 20:53:34 +02:00
co-authored by Claude Sonnet 5.5
parent ed6fe12ada
commit dadc1f3ec4
@@ -177,6 +177,26 @@ final class DiviContentComposerTest extends TestCase
self::assertSame([], $this->saved); self::assertSame([], $this->saved);
} }
/** Ruling X3: a new entry has no loop scope (nor has a new Theme Builder layout, same LayoutBuilder). */
public function testNewEntriesRefuseLoopContentWithTheLoopMessage(): void
{
$refused = $this->composer()->check('page', [
['type' => 'section', 'modules' => [['type' => 'text', 'content' => '{{loop:post_title}}']]],
]);
self::assertInstanceOf(WP_Error::class, $refused);
self::assertStringContainsString('braucht eine Divi-Schleife', implode(' ', self::errorFields($refused)));
// A new loop container does not open a scope for its content in the same call either.
$inNewLoop = $this->composer()->check('page', [[
'type' => 'section',
'attrs' => ['module.advanced.loop' => ['desktop' => ['enable' => 'on', 'queryType' => 'post_types']]],
'modules' => [['type' => 'text', 'content' => '{{loop:post_title}}']],
]]);
self::assertInstanceOf(WP_Error::class, $inNewLoop);
self::assertStringContainsString('braucht eine Divi-Schleife', implode(' ', self::errorFields($inNewLoop)));
}
public function testAFailingSaveIsThrown(): void public function testAFailingSaveIsThrown(): void
{ {
$this->saver = Mockery::mock(DiviSaver::class); $this->saver = Mockery::mock(DiviSaver::class);