Files
heretek-control-core/tests/ContainerSupportTest.php
Mian Shahzad RazaandClaude Opus 4.8 5748f005b0 fix(#111,#112): container-experiment guard + atomic dynamic-prop save fallback
#111 (part 2): on installs with Elementor's Flexbox Container experiment OFF, the
'container' element type is unregistered, so add-container/build-page stored pages
that render empty (Elements_Manager skips the uninstantiable element). Add
EMCP_Tools_Atomic_Props::is_container_supported() (authoritative element-type check),
refuse add-container/build-page up front with an actionable container_unsupported
error, and surface supports_container + a warning + recommended_mode='unsupported'
from detect-elementor-version.

#112: Document::save() THROWS Elementor's atomic settings/styles validation on an
editor-authored {$$type:'dynamic'} paragraph whose tag the CLI/REST atomic
dynamic-tags registry can't resolve, and because save() validates the whole tree it
blocked EVERY edit to the document. Route a validation-rejection throw into the
existing raw meta-write fallback (the tree is already coerce_tree'd, so what remains
is data the editor itself persists) via EMCP_Tools_Data::is_atomic_validation_rejection();
genuine fatals still hard-fail.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-08-13 12:57:45 +05:00

27 lines
1.2 KiB
PHP

<?php
/**
* Public unit test for EMCP_Tools_Atomic_Props::is_container_supported() — the
* issue #111 (part 2) fix. On installs where Elementor's Flexbox Container
* experiment is OFF, the `container` element type is not registered, so
* add-container / build-page would store a page that renders empty. This helper
* reports whether a `container` will render, and the creation tools refuse up
* front when it won't. The false path (experiment off) is verified live by
* toggling the experiment; here we pin that the helper never fatals and returns
* true when Elementor is not loaded at all (the callers guard Elementor
* separately, so a non-Elementor context must not block).
*
* @package EMCP_Tools
*/
require_once dirname( __DIR__ ) . '/includes/class-atomic-props.php';
class ContainerSupportTest extends \PHPUnit\Framework\TestCase {
public function test_returns_true_when_elementor_absent() {
// The test harness does not load Elementor, so the guard's first branch
// (class_exists '\Elementor\Plugin' === false) returns true.
$this->assertFalse( class_exists( '\Elementor\Plugin' ), 'harness must not load Elementor' );
$this->assertTrue( EMCP_Tools_Atomic_Props::is_container_supported() );
}
}