Skip to content

Run plugin tests from the plugins' own repositories (shop) - #671

Merged
uldisrudzitis merged 1 commit into
masterfrom
shop-tests-in-plugin
Oct 28, 2026
Merged

uldisrudzitis merged 1 commit into
masterfrom
shop-tests-in-plugin

Conversation

@uldisrudzitis

@uldisrudzitis uldisrudzitis commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

The shop plugin's Pest tests move to its own repository, as the AI assistant plugin's did on mcp-integration (#668). So the main repository only tests core, and an install without the shop simply has no shop tests instead of skipping them.

Companion change in the shop plugin repository (Bitbucket berta-shop-laravel-plugin), branch shop-tests-in-plugin.

Changes

  • Plugin test suite: phpunit.xml has a Plugins suite for app/Plugins/*/tests (excluded from the source), and tests/Pest.php binds TestCase there too. These are the same lines as on mcp-integration, so the two branches merge without conflicts there.
  • Plugin test helpers: tests/Pest.php loads each plugin's tests/Helpers.php when it exists. Pest only loads the main tests/Pest.php, so this is how a plugin shares helpers between its tests.
  • Removed from core:
    • the shop tests: ShopControllerTest, ShopStorefrontControllerTest, ShopInvoiceTest, ShopCartRenderServiceTest (and its Pest snapshots), SectionHeadShopStylesTest, SitesDataServiceTest (all about the site's shop files)
    • the shop helpers in tests/Pest.php, including isShopPluginInstalled() and skipWithoutShopPlugin()
  • SiteTemplatesConfigServiceTest keeps the core case only: no shop section types on a domain without the shop. The case with the shop moved to the plugin.
  • Kept in core, since they test core code: WebAccessRulesTest (the .htaccess rules for _shop_files), SitemapRenderServiceTest, SiteSettingsConfigServiceTest.

Merge notes

  • Merge together with the shop plugin branch: without it, the shop's tests are gone from both places.
  • mcp-integration changes setUpShopTestRoot() in core tests/Pest.php to use linkBertaEngine(). This branch moves that helper to the plugin's tests/Helpers.php, so whichever merges second needs a small manual merge there (the plugin's copy should call linkBertaEngine()).

Test plan

  • php artisan test --compact app/Plugins/Shop/tests: 212 passed (the 212 shop tests that core skipped without the plugin)
  • php artisan test --compact --testsuite=Unit,Feature: 111 passed, with and without the shop plugin installed, nothing skipped for the shop
  • Pint clean

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added a dedicated test suite for tests located within plugins.
    • Removed several shop-related feature test files from the main test suite.
    • Updated template configuration coverage to verify that shop sections are absent on non-shop domains. No end-user functionality changes are indicated.

phpunit.xml and Pest pick up app/Plugins/*/tests, and Pest loads each
plugin's tests/Helpers.php, so the shop plugin's tests and helpers move
to its repository. Core keeps the tests of core code, including the
template's section types on a domain without the shop.

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

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa3037d5-7dfa-4334-86e5-48c784f2966e
Commits

Reviewing files that changed from the base of the PR and between 9bdd59c and 146a992.

Files ignored due to path filters: 4
  • _api_app/tests/.pest/snapshots/Feature/ShopCartRenderServiceTest/_editable_texts__→_it_renders_the_cart_texts_with_data_set__dataset__in_the_editor__by_default__.snap is excluded by !**/*.snap
  • _api_app/tests/.pest/snapshots/Feature/ShopCartRenderServiceTest/_editable_texts__→_it_renders_the_cart_texts_with_data_set__dataset__in_the_editor__customised__.snap is excluded by !**/*.snap
  • _api_app/tests/.pest/snapshots/Feature/ShopCartRenderServiceTest/_editable_texts__→_it_renders_the_cart_texts_with_data_set__dataset__on_the_site__by_default__.snap is excluded by !**/*.snap
  • _api_app/tests/.pest/snapshots/Feature/ShopCartRenderServiceTest/_editable_texts__→_it_renders_the_cart_texts_with_data_set__dataset__on_the_site__customised__.snap is excluded by !**/*.snap
Files selected for processing: 9
  • _api_app/phpunit.xml
  • _api_app/tests/Feature/SectionHeadShopStylesTest.php
  • _api_app/tests/Feature/ShopCartRenderServiceTest.php
  • _api_app/tests/Feature/ShopControllerTest.php
  • _api_app/tests/Feature/ShopInvoiceTest.php
  • _api_app/tests/Feature/ShopStorefrontControllerTest.php
  • _api_app/tests/Feature/SiteTemplatesConfigServiceTest.php
  • _api_app/tests/Feature/SitesDataServiceTest.php
  • _api_app/tests/Pest.php
Files with no reviewable changes: 6
  • _api_app/tests/Feature/SitesDataServiceTest.php
  • _api_app/tests/Feature/SectionHeadShopStylesTest.php
  • _api_app/tests/Feature/ShopCartRenderServiceTest.php
  • _api_app/tests/Feature/ShopControllerTest.php
  • _api_app/tests/Feature/ShopInvoiceTest.php
  • _api_app/tests/Feature/ShopStorefrontControllerTest.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The test configuration now discovers plugin tests and loads plugin test helpers. Several shop-specific feature test files and shared helpers were removed. The remaining site template test checks that shop section types are absent on a non-shop domain.

Changes: Plugin test discovery and setup

Layer / File(s) Summary
Plugin test discovery and setup
_api_app/phpunit.xml, _api_app/tests/Pest.php
PHPUnit discovers tests under plugin directories and excludes those tests from source coverage. Pest applies its test binding to plugin test directories and loads matching plugin helper files. The shop-specific test setup helpers were removed from Pest.
Shop feature test changes
_api_app/tests/Feature/SectionHeadShopStylesTest.php, _api_app/tests/Feature/ShopCartRenderServiceTest.php, _api_app/tests/Feature/ShopControllerTest.php, _api_app/tests/Feature/ShopInvoiceTest.php, _api_app/tests/Feature/ShopStorefrontControllerTest.php, _api_app/tests/Feature/SiteTemplatesConfigServiceTest.php, _api_app/tests/Feature/SitesDataServiceTest.php
Five shop-specific feature test files and SitesDataServiceTest.php were deleted. The site template test now checks only that shop and shopping_cart sections are absent on other.test; a comment assigns shop-domain coverage to plugin tests.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: Minimal · up to 146a9

Shop tests move to the plugin suite. Merge alongside the shop plugin branch and run its tests.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Run plugin tests from the plugins' own repositories (shop)" matches the main change. The PR moves the shop plugin's Pest tests and helpers out of core into the shop plugin repository. It al…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Run plugin tests from the plugins' own repositories (shop)" matches the main change. The PR moves the shop plugin's Pest tests and helpers out of core into the shop plugin repository. It also adds a Plugins PHPUnit suite and loads each plugin's tests/Helpers.php from tests/Pest.php. The title is specific, short, and free of file lists or vague terms. It does not name the test-discovery configuration, but that is a secondary detail.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@uldisrudzitis
uldisrudzitis merged commit 1ed1c9e into master Oct 28, 2026
7 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