Skip to content

Align the module with the PrestaEdit blog series - #1

Merged
PrestaEdit merged 7 commits into
mainfrom
feat/align-with-blog-series
Sep 25, 2026
Merged

PrestaEdit merged 7 commits into
mainfrom
feat/align-with-blog-series

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Makes psflowdemo the module the PrestaFlow article series on the PrestaEdit blog actually describes, so every example in the articles runs against the real repository.

The module

  • Home block #psflowdemo-block with a configurable h3 title, rendered by views/templates/hook/displayHome.tpl and escaped on output.
  • Back-office configuration page (HelperForm): field PSFLOWDEMO_TITLE, button submitPsflowdemo, default title « Bienvenue sur notre boutique », set on install and removed on uninstall.
  • Compatible PrestaShop 1.7.8 → 9 (module code PHP 7.2+).

The full contract (selectors, keys, messages) is in the README.

Tests

  • PrestaFlow suites moved to tests/prestaflow/ (PSR-4 Tests\), with the layout used in the articles: DisplayHome, UpdateTitle, Checkout, Smoke, Regression/NoXssInBlockTitle.
  • Flashlight init-scripts in tests/flashlight-init/: install the module, seed the title.

vendor-dev/ instead of vendor/

PrestaShop includes modules/<module>/vendor/autoload.php for every installed module. The PrestaFlow library brings Symfony 6 components that clash with the shop's and crash it (checked on PrestaShop 8.1.7), so dev dependencies live in vendor-dev/.

The CLI is exposed as composer prestaflow -- <args>, with process-timeout: 0: Composer kills scripts after 300 s. Paths are passed as ./tests/..., because PrestaFlow 1.7.1 ucfirst()s the folder argument, which breaks on Linux.

Verified

  • Checked for real on Flashlight 8.1.7 + MariaDB 11: DisplayHome, UpdateTitle, Regression and Smoke pass. The regression suite turns red with an unescaped template.
  • Checkout stops at the payment step: a fresh Flashlight shop has no active payment module.
  • PrestaShop 1.7.8 and 9, and the CI workflow, are checked syntactically only.

🤖 Generated with Claude Code

PrestaEdit and others added 5 commits September 24, 2026 16:58
- displayHome renders #psflowdemo-block with the title in an h3, from
  views/templates/hook/displayHome.tpl, escaped on output
- getContent() renders a HelperForm (PSFLOWDEMO_TITLE, submitPsflowdemo)
  and shows the core "Settings updated" confirmation; empty titles are refused
- install sets PSFLOWDEMO_TITLE to "Bienvenue sur notre boutique",
  uninstall deletes it; compatible PrestaShop 1.7.8 to 9, PHP 7.2+

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tests/prestaflow autoloaded as Tests\, suites in Tests\Suites
- Home and Configuration pages for v7/v8/v9, shared logic in Pages/Common
- DisplayHome, UpdateTitle, Checkout, Regression/NoXssInBlockTitle and a
  browser-free Smoke suite
- Flashlight init-scripts that install the module and seed its title
- dev dependencies in vendor-dev/: PrestaShop includes the vendor/autoload.php
  of installed modules, and the library's Symfony 6 packages crash the shop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`composer prestaflow -- <args>` now forwards to the CLI, so the blog
articles can show the same command whatever the vendor dir or library
version. The former all-suites script becomes `prestaflow:all`.
process-timeout is disabled: Composer kills scripts after 300 s by
default, which an end-to-end run easily exceeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PrestaFlow 1.7.1 ucfirst()s the folder argument, so tests/prestaflow
becomes Tests/prestaflow: fine on macOS, not found on Linux (CI), and the
run still exits 0. A ./ prefix is left untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

PrestaFlow — Test report

Result: ❌ 3 failures out of 18 tests

Passed Failed Skipped Duration
8 ✅ 3 ❌ 7 ⏭️ 42s
Suite ✔ Passed ✘ Failed Duration
Tests\Suites\Checkout 0 1 11s
Tests\Suites\DisplayHome 2 0 0s
Tests\Suites\Regression\NoXssInBlockTitle 1 1 19s
Tests\Suites\Smoke 4 0 0s
Tests\Suites\UpdateTitle 1 1 11s

PS 1.7.8.11

Failure details (3)

❌ Tests\Suites\Checkout / add a product to the cart

false must be equal to 1
/home/runner/work/psflowdemo/psflowdemo/vendor-dev/prestaflow/php-library/src/Scenarios/GuestCheckout.php:54

❌ Tests\Suites\Regression\NoXssInBlockTitle / accepte un titre contenant du HTML/JS depuis la config

Tests\Pages\Common\Modules\Psflowdemo\Configuration\Page::openConfiguration(): Argument #1 ($boUrl) must be of type string, null given, called in /home/runner/work/psflowdemo/psflowdemo/tests/prestafl…
/home/runner/work/psflowdemo/psflowdemo/tests/prestaflow/Suites/Regression/NoXssInBlockTitle.php:32

❌ Tests\Suites\UpdateTitle / met à jour le titre du bloc

Cannot load page for url: "/index.php?controller=AdminModules&configure=psflowdemo". Reason: -32000 - Cannot navigate to invalid URL
/home/runner/work/psflowdemo/psflowdemo/tests/prestaflow/Suites/UpdateTitle.php:28

Generated by PrestaFlow/github-action@v2 · commit f8f3285

A fresh Flashlight shop is installed with GB as its country, and its
payment modules (ps_wirepayment, ps_checkpayment, ps_cashondelivery) are
restricted to GB in ps_module_country. The library's GuestCheckout
scenario uses a French address, so no payment method was offered and the
Checkout suite failed. France is not even active on the 1.7.8.11 image.

The init-script activates France and opens every paymentOptions module
to every active country, in every shop. Idempotent.

Checked on fresh Flashlight 8.1.7 shops: without the script Checkout
fails at the address step, with it all four steps pass (order
confirmation reached). On 1.7.8.11 and 9.0.0 the suite fails earlier, at
add-to-cart, for an unrelated library reason (page closed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 'page was closed' failures seen on 1.7.8.11 and 9.0.0 were not
version-specific: two PrestaFlow processes running at once shared one
browser file, and each closed the other's Chrome at exit. Fixed in the
library; with the payment init-script, Checkout passes on all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

PrestaFlow — Test report ✅ · PS 1.7.8.11

18 tests passed in 27s

Suite ✔ Passed ✘ Failed Duration
Tests\Suites\Checkout 4 0 9s
Tests\Suites\DisplayHome 2 0 0s
Tests\Suites\Regression\NoXssInBlockTitle 4 0 11s
Tests\Suites\Smoke 4 0 0s
Tests\Suites\UpdateTitle 4 0 6s

PS 1.7.8.11

Generated by PrestaFlow/github-action@v2 · commit de8cdf2

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

PrestaFlow — Test report ✅ · PS 9.0.0

18 tests passed in 59s

Suite ✔ Passed ✘ Failed Duration
Tests\Suites\Checkout 4 0 11s
Tests\Suites\DisplayHome 2 0 1s
Tests\Suites\Regression\NoXssInBlockTitle 4 0 19s
Tests\Suites\Smoke 4 0 0s
Tests\Suites\UpdateTitle 4 0 29s

PS 9.0.0

📊 View full report

Generated by PrestaFlow/github-action@v2 · commit de8cdf2

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

PrestaFlow — Test report ✅ · PS 8.1.7

18 tests passed in 27s

Suite ✔ Passed ✘ Failed Duration
Tests\Suites\Checkout 4 0 13s
Tests\Suites\DisplayHome 2 0 1s
Tests\Suites\Regression\NoXssInBlockTitle 4 0 8s
Tests\Suites\Smoke 4 0 0s
Tests\Suites\UpdateTitle 4 0 6s

PS 8.1.7

Generated by PrestaFlow/github-action@v2 · commit de8cdf2

@PrestaEdit
PrestaEdit force-pushed the feat/align-with-blog-series branch from 39ef9cf to acfa3f1 Compare September 25, 2026 08:52
@PrestaEdit
PrestaEdit merged commit 788a504 into main Sep 25, 2026
10 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant