[Feature]: Add Test Infrastructure for Core Carousel Plugin#19
Merged
theMasudRana merged 5 commits intomainfrom Feb 5, 2026
Merged
[Feature]: Add Test Infrastructure for Core Carousel Plugin#19theMasudRana merged 5 commits intomainfrom
theMasudRana merged 5 commits intomainfrom
Conversation
- Add Jest configuration (jest.config.js) - Add PHPUnit configuration (phpunit.xml.dist) - Update package.json with test scripts and devDependencies - Update composer.json with PHPUnit, Brain\Monkey dependencies - Add test setup files and mocks (tests/js/, tests/php/)
- Add JS tests for view.ts (86 tests) - Add JS tests for types.ts validation - Add PHP tests for Plugin class - Add PHP tests for Singleton trait
Contributor
There was a problem hiding this comment.
Pull request overview
This PR establishes comprehensive testing infrastructure for the Core Carousel plugin, adding both JavaScript and PHP unit tests along with CI/CD automation.
Changes:
- Added Jest-based JavaScript testing with 86 tests covering carousel store, state management, actions, and type definitions
- Added PHPUnit-based PHP testing with 14 tests covering plugin initialization, singleton pattern, and block registration
- Integrated GitHub Actions workflow for automated testing on push and pull requests
Reviewed changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| jest.config.js | Jest configuration extending @wordpress/scripts with coverage thresholds and module aliases |
| tests/js/setup.ts | Global test setup with mocks for WordPress and Embla Carousel dependencies |
| tests/js/mocks/wordpress-interactivity.ts | Mock implementation of WordPress Interactivity API |
| src/blocks/carousel/tests/view.test.ts | Comprehensive tests for carousel frontend logic (86 tests) |
| src/blocks/carousel/tests/types.test.ts | Type validation tests for TypeScript definitions |
| tests/js/tsconfig.json | TypeScript configuration for Jest tests |
| phpunit.xml.dist | PHPUnit configuration for PHP unit tests |
| tests/phpstan/constants.php | PHPStan bootstrap constants for static analysis |
| tests/php/bootstrap.php | PHPUnit bootstrap with Brain\Monkey setup |
| tests/php/Unit/UnitTestCase.php | Base test case class for unit tests |
| tests/php/Unit/Traits/SingletonTest.php | Tests for Singleton trait behavior |
| tests/php/Unit/PluginTest.php | Tests for Plugin class covering block/pattern registration |
| package.json | Added Jest testing dependencies and test scripts |
| composer.json | Added PHPUnit, Brain\Monkey, and Yoast PHPUnit Polyfills dependencies |
| .github/workflows/tests.yml | CI/CD workflow for JavaScript tests, PHP tests, and build verification |
| core-carousel.php | Updated plugin headers with GitHub URL and version requirements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
danish17
approved these changes
Feb 5, 2026
theMasudRana
added a commit
that referenced
this pull request
Feb 5, 2026
Revert "Merge pull request #19 from rtCamp/feat/add-test-for-plugin"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Test Infrastructure for Core Carousel Plugin
Summary
This PR adds comprehensive JavaScript and PHP testing infrastructure along with CI/CD integration for automated test execution.
Changes
Test Infrastructure
jest.config.js): Custom config extending@wordpress/scriptswith coverage thresholds, module aliases, and test setupphpunit.xml.dist): PHP unit test configuration with Brain\Monkey integrationJavaScript Tests (86 tests)
view.test.ts: Tests for carousel store registration, state getters, actions (scrollPrev, scrollNext, onDotClick), callbacks, and error handlingtypes.test.ts: Type validation tests for CarouselAttributes and CarouselContextPHP Tests (14 tests)
PluginTest.php: Tests for block category registration, block registration, pattern category, and block patternsSingletonTest.php: Tests for the Singleton trait behaviorDependencies
package.jsoncomposer.jsonScreenshot
Testing