diff --git a/Observer/View/BlockToHtmlAfter.php b/Observer/View/BlockToHtmlAfter.php
index e8c7403..ee8dcad 100644
--- a/Observer/View/BlockToHtmlAfter.php
+++ b/Observer/View/BlockToHtmlAfter.php
@@ -19,7 +19,7 @@ public function __construct(
*/
public function execute(Observer $observer)
{
- if (!$this->config->isEnabled() && !$this->config->isPageBuilderPreloadEnabled()) {
+ if (!$this->config->isEnabled() || !$this->config->isPageBuilderPreloadEnabled()) {
return;
}
diff --git a/Test/Unit/Observer/View/BlockToHtmlAfterTest.php b/Test/Unit/Observer/View/BlockToHtmlAfterTest.php
index 879cd5d..b916315 100644
--- a/Test/Unit/Observer/View/BlockToHtmlAfterTest.php
+++ b/Test/Unit/Observer/View/BlockToHtmlAfterTest.php
@@ -47,7 +47,6 @@ protected function setUp(): void
public function testDoesNothingWhenBothConfigsDisabled(): void
{
- // Note: The condition is: if (!isEnabled && !isPageBuilderPreloadEnabled)
$this->configMock->method('isEnabled')->willReturn(false);
$this->configMock->method('isPageBuilderPreloadEnabled')->willReturn(false);
@@ -158,34 +157,32 @@ public function testIgnoresImagesWithoutPreloadAttribute(): void
$this->subject->execute($this->observerMock);
}
- public function testExecutesWhenOnlyModuleEnabled(): void
+ public function testDoesNothingWhenOnlyModuleEnabled(): void
{
+ // Master 'Enabled' switch alone is not sufficient - the pagebuilder_content
+ // toggle must also be on, matching every other observer in this module.
$this->configMock->method('isEnabled')->willReturn(true);
$this->configMock->method('isPageBuilderPreloadEnabled')->willReturn(false);
$html = '
';
$this->transport->setHtml($html);
- $preloadMock = $this->createMock(Preload::class);
- $this->preloadFactoryMock->method('create')->willReturn($preloadMock);
-
- $this->linkStoreMock->expects($this->once())->method('add');
+ $this->linkStoreMock->expects($this->never())->method('add');
$this->subject->execute($this->observerMock);
}
- public function testExecutesWhenOnlyPageBuilderPreloadEnabled(): void
+ public function testDoesNothingWhenOnlyPageBuilderPreloadEnabled(): void
{
+ // pagebuilder_content toggle alone is not sufficient if the master
+ // 'Enabled' switch is off - it must act as a full kill-switch.
$this->configMock->method('isEnabled')->willReturn(false);
$this->configMock->method('isPageBuilderPreloadEnabled')->willReturn(true);
$html = '
';
$this->transport->setHtml($html);
- $preloadMock = $this->createMock(Preload::class);
- $this->preloadFactoryMock->method('create')->willReturn($preloadMock);
-
- $this->linkStoreMock->expects($this->once())->method('add');
+ $this->linkStoreMock->expects($this->never())->method('add');
$this->subject->execute($this->observerMock);
}