From dadc1f3ec41f191c792f66fbd4296be5eeff33d4 Mon Sep 17 00:00:00 2001 From: Jan-Niclas Loosen Date: Mon, 19 Oct 2026 20:53:34 +0200 Subject: [PATCH] =?UTF-8?q?test:=20lit-content-create=20hat=20keinen=20Sch?= =?UTF-8?q?leifen-Kontext=20=E2=80=93=20loop=5F*=20mit=20der=20Schleifen-M?= =?UTF-8?q?eldung=20abgelehnt=20(X3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- .../Divi/Pages/DiviContentComposerTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Unit/Integrations/Divi/Pages/DiviContentComposerTest.php b/tests/Unit/Integrations/Divi/Pages/DiviContentComposerTest.php index 32d7b7d..09848a7 100644 --- a/tests/Unit/Integrations/Divi/Pages/DiviContentComposerTest.php +++ b/tests/Unit/Integrations/Divi/Pages/DiviContentComposerTest.php @@ -177,6 +177,26 @@ final class DiviContentComposerTest extends TestCase 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 { $this->saver = Mockery::mock(DiviSaver::class);