Feature :: D5 :: Tests :: 3PS :: Track C :: EX-02 StaticModule - #75
Conversation
Add PHP registration and FE snapshot tests plus metadata and RTL edit snapshot coverage for StaticModule without changing module runtime code. Co-authored-by: Cursor <cursoragent@cursor.com>
ayubadiputra
left a comment
There was a problem hiding this comment.
@robicse11127 BTW, the npm test passed on my local, but not the composer test.
There was 1 failure:
1) StaticModuleRenderTest::test_render_outputs_summary_html_snapshot
Failed asserting that two strings are equal.
Snapshots can be updated by passing `-d --update-snapshots` through PHPUnit's CLI arguments.
--- Expected
+++ Actual
@@ @@
'<html><body>\n
-<div class="example_static_module_0 example_static_module et_pb_bg_layout_light et_pb_module"><div class="example_static_module__inner">\n
-<div class="example_static_module__image"><div>New</div></div>\n
+<div class="example_static_module_0 example_static_module et_pb_bg_layout_light et_pb_module et_flex_module"><div class="example_static_module__inner">\n
+<div class="example_static_module__image"><span class="example_static_module__badge">New</span></div>\n
<div class="example_static_module__content-container">\n
-<div>Static module summary text for snapshot testing.</div>\n
+<div class="example_static_module__summary">Static module summary text for snapshot testing.</div>\n
<div class="example_static_module__content"></div>\n
</div>\n
</div></div>\n
<style>.example_static_module_0 {padding-top: 30px; padding-right: 30px; padding-bottom: 30px; padding-left: 30px;}\n
.example_static_module_0 .example_static_module__content-container {text-align: start;}\n
-color: #ffffff;</style>\n
+.example_static_module_0 .example_static_module__badge {color: #ffffff;}</style>\n
</body></html>\n
'
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/themes/Divi/includes/builder-5/server/__TESTS__/config/Helpers/Drivers/HtmlDriver.php:79
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/themes/Divi/includes/builder-5/server/vendor/spatie/phpunit-snapshot-assertions/src/Snapshot.php:55
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/themes/Divi/includes/builder-5/server/vendor/spatie/phpunit-snapshot-assertions/src/MatchesSnapshots.php:187
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/themes/Divi/includes/builder-5/server/__TESTS__/config/TestCases/DiviWPUnitTest.php:513
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/themes/Divi/includes/builder-5/server/__TESTS__/config/TestCases/DiviWPUnitTest.php:496
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/plugins/d5-extension-example-modules/tests/php/Snapshot/StaticModuleRenderTest.php:67
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/plugins/d5-extension-example-modules/vendor/phpunit/phpunit/src/TextUI/Command.php:146
/Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/plugins/d5-extension-example-modules/vendor/phpunit/phpunit/src/TextUI/Command.php:99
phpvfscomposer:///Users/ayubadiputra/Local Sites/etdev-d5-review/app/public/wp-content/plugins/d5-extension-example-modules/vendor/phpunit/phpunit/phpunit:106
FAILURES!
Tests: 10, Assertions: 18, Failures: 1.
Script phpunit handling the test event returned with error code 1
FYI, composer test on main branch is passed on my local which means my setup is correct. However, the composer test on this PR branch is failed.
… Divi (#50791) Update the PHP HTML snapshot to match newer Divi element render output so composer test passes in the ET review environment. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@ayubadiputra I have updated the snapshots. Hopefully it will pass at your end as well. Thanks. |
|
@robicse11127 Thanks! All passed, |
bitfade
left a comment
There was a problem hiding this comment.
@robicse11127 please resolve merge conflicts.
Integrate DynamicModule test stack from main while preserving StaticModule EX-02 smoke and module test configuration. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@bitfade I have resolved the conflicts. Please check it once. Thanks. |
|
@bitfade It been stuck for a while now. Please check it once you may. Thanks. |
DeepHive Agent Merge (observe)Mode: Would leave for humans (stay in Dev Review). Reason: human CHANGES_REQUESTED is open Signals
|
Summary
This PR adds the EX-01 test harness for
d5-extension-example-modules. All changes are confined to this plugin repo. No production module behavior is modified.DIVI_PATH, plugin-localwp-tests-config.php, and three smoke tests.module.jsonsmoke test.This harness unblocks EX-02–EX-05 module-specific tests.
What changed
PHP
phpunit.xmltests/php/bootstrap.phptests/php/test-environment.phptests/php/wp-tests-config.phptests/php/.env.exampletests/php/PluginSmokeTest.phpcomposer.jsonphpunit/phpunit,yoast/phpunit-polyfills,composer testscriptJavaScript
test-config/jest.smoke.config.jstest-config/jest-rtl-setup.js@testing-library/jest-dommatcherstest-config/jest.config.jstest-config/babel-transformer.jssrc/components/static-module/__tests__/module-json.test.tsmodule.jsonsmoke testpackage.jsonnpm test(smoke),npm run test:modules(full harness)Other
README.md.gitignore.phpunit.result.cacheTest plan
50726-d5-3ps-trac-c-ex01tests/php/.env.exampletotests/php/.envand set local pathsmysqlienabledcomposer installandnpm installcomposer test— expect 3 passing testsnpm test— expect 1 passing testLocal setup (example)
Verification report
Verified locally on 2026-06-30 using PHP 7.4.33 with mysqli and WordPress 6.9.
Verification results
composer testnpm testPHP smoke tests
D5_EXTENSION_EXAMPLE_MODULES_PATHconstant is defined after bootstrap.MEE\Modules\StaticModule\StaticModuleautoloads via Composer.JS smoke test
src/components/static-module/module.jsonparses with expected metadata (name,title,moduleClassName).Notes for reviewers
DIVI_PATH(read-only; no Divi repo changes).npm testruns the EX-01 smoke config only.npm run test:modulesis the full Divi/WordPress Jest harness for upcoming module tests.mysqliextension. Use PHP 7.4 if that is your local standard.Out of scope
d5-extension-example-modules