Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: Code style and static analysis

on:
pull_request:
push:
branches: [master]

permissions:
contents: read

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest

container:
image: mohelmrabet/magento-frankenphp:php8.2-fp1.10.1-dev

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run PHPStan
uses: mohaelmrabet/magento-php-qa-action@v1
with:
command: phpstan
composer-auth: ${{ format('{{"http-basic":{{"repo.magento.com":{{"username":"{0}","password":"{1}"}}}}}}', secrets.MAGENTO_AUTH_USERNAME, secrets.MAGENTO_AUTH_PASSWORD) }}

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest

container:
image: mohelmrabet/magento-frankenphp:php8.2-fp1.10.1-dev

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run PHP-CS-Fixer
uses: mohaelmrabet/magento-php-qa-action@v1
with:
command: cs-fixer
composer-auth: ${{ format('{{"http-basic":{{"repo.magento.com":{{"username":"{0}","password":"{1}"}}}}}}', secrets.MAGENTO_AUTH_USERNAME, secrets.MAGENTO_AUTH_PASSWORD) }}

unit-tests:
name: PHPUnit
runs-on: ubuntu-latest

container:
image: mohelmrabet/magento-frankenphp:php8.2-fp1.10.1-dev

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run PHPUnit
uses: mohaelmrabet/magento-php-qa-action@v1
with:
command: phpunit
composer-auth: ${{ format('{{"http-basic":{{"repo.magento.com":{{"username":"{0}","password":"{1}"}}}}}}', secrets.MAGENTO_AUTH_USERNAME, secrets.MAGENTO_AUTH_PASSWORD) }}
phpunit-path: ./Test/Unit
13 changes: 13 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
->in(__DIR__ . '/Console')
->in(__DIR__ . '/Test');

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
])
->setFinder($finder);
18 changes: 18 additions & 0 deletions .phpstan-bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/**
* Copyright (c) 2025 Mohamed EL Mrabet
* CleatSquad - https://cleatsquad.dev
*
* This file is part of the CleatSquad_ParallelTestsPlus module.
* Licensed under the MIT License. See the LICENSE file in the module root.
*/
declare(strict_types=1);

/**
* BP is defined at runtime by Magento's app/bootstrap.php; declare it here
* so PHPStan can resolve it statically without a real Magento installation.
*/
if (!defined('BP')) {
define('BP', __DIR__);
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.0.0] - 2025-11-22

### Added

- Initial release.
- DI override of `Magento\Developer\Console\Command\DevTestsRunCommand` to run
developer tests through ParaTest.
- `--processes` option to set the number of ParaTest worker processes.
- `--runner` option to select the ParaTest runner (default: `WrapperRunner`).
- Support for static, unit, integration and integrity test suites.

[1.0.0]: https://github.com/CleatSquad/module-parallel-tests-plus/releases/tag/v1.0.0
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing

Thanks for considering a contribution to `module-parallel-tests-plus`.

## Getting started

```bash
git clone https://github.com/CleatSquad/module-parallel-tests-plus.git
cd module-parallel-tests-plus
composer install
```

> Resolving `magento/module-developer` requires a valid Magento Marketplace
> `auth.json` (see the README's Installation section).

## Running the tests

```bash
composer test
```

or directly:

```bash
vendor/bin/phpunit --testsuite unit
```

## Submitting changes

1. Fork the repository and create a branch from `master`.
2. Keep changes focused — one topic per pull request.
3. Add or update unit tests for any behavior change in
`Console/DevTestsRunCommand.php`.
4. Make sure `composer test` passes before opening the PR.
5. Describe the *why* of the change in the PR description, not just the *what*.

## Reporting bugs

Open an issue at
https://github.com/CleatSquad/module-parallel-tests-plus/issues with the
Magento version, PHP version, the command you ran, and the full output.

## Security issues

Do not open a public issue for a security vulnerability — see
[SECURITY.md](SECURITY.md).
1 change: 1 addition & 0 deletions Console/DevTestsRunCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2025 Mohamed EL Mrabet
* CleatSquad - https://cleatsquad.dev
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

A Magento 2 extension that enhances the core `dev:tests:run` command by enabling **parallel execution** of developer tests using **ParaTest**.

This module significantly reduces execution time for static, unit, integration and integrity tests — with zero core overrides and full CI/CD compatibility.
This module significantly reduces execution time for static, unit, integration and integrity tests — via a clean declarative DI override (no core file patching) and full CI/CD compatibility.

## Badges

[![CI](https://github.com/CleatSquad/module-parallel-tests-plus/actions/workflows/ci.yml/badge.svg)](https://github.com/CleatSquad/module-parallel-tests-plus/actions/workflows/ci.yml)
[![Latest Stable Version](http://poser.pugx.org/cleatsquad/module-parallel-tests-plus/v)](https://packagist.org/packages/cleatsquad/module-parallel-tests-plus)
[![Total Downloads](http://poser.pugx.org/cleatsquad/module-parallel-tests-plus/downloads)](https://packagist.org/packages/cleatsquad/module-parallel-tests-plus)
[![Latest Unstable Version](http://poser.pugx.org/cleatsquad/module-parallel-tests-plus/v/unstable)](https://packagist.org/packages/cleatsquad/module-parallel-tests-plus)
Expand Down Expand Up @@ -40,12 +41,14 @@ You can install this module using Composer (recommended) or manually.

### 🔹 1. Install via Composer (recommended)

Requires Packagist entry:

```
composer require cleatsquad/module-parallel-tests-plus --dev
```

> **Note:** this package depends on `magento/module-developer`, resolved via
> `repo.magento.com`. Make sure your project has a valid Magento Marketplace
> `auth.json` configured, otherwise Composer will fail to resolve it.

Then upgrade Magento:

```
Expand Down Expand Up @@ -111,7 +114,9 @@ bin/magento dev:tests:run integration --processes 2 -c" testsuite/Magento/Catalo

## 🤝 Support & Contributions

Issues and pull requests are welcome.
Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
For security issues, see [SECURITY.md](SECURITY.md) instead of opening a
public issue.

GitHub:
https://github.com/CleatSquad/module-parallel-tests-plus
Expand Down
18 changes: 18 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Security Policy

## Supported Versions

Only the latest published `1.x` release is supported with security fixes.

## Reporting a Vulnerability

This module builds and runs a shell command (via `passthru()`) to invoke
ParaTest. If you find a way to make it execute unintended shell content, or
any other security issue, please report it privately rather than opening a
public GitHub issue:

- Email: contact@cleatsquad.dev

Please include a description of the issue, the steps to reproduce it, and
the Magento/PHP versions involved. We aim to acknowledge reports within a
few business days.
2 changes: 1 addition & 1 deletion Test/Unit/Console/DevTestsRunCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2025 Mohamed EL Mrabet
* CleatSquad - https://cleatsquad.dev
Expand All @@ -14,7 +15,6 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Tester\CommandTester;


require_once __DIR__ . '/../_files/mock_passthru.php';

/**
Expand Down
42 changes: 42 additions & 0 deletions Test/Unit/_files/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* Copyright (c) 2025 Mohamed EL Mrabet
* CleatSquad - https://cleatsquad.dev
*
* This file is part of the CleatSquad_ParallelTestsPlus module.
* Licensed under the MIT License. See the LICENSE file in the module root.
*/
declare(strict_types=1);

require __DIR__ . '/../../../vendor/autoload.php';

/**
* DevTestsRunCommand reads Magento's BP constant and app/etc/vendor_path.php.
* Outside a real Magento installation (e.g. running this module's own unit
* tests standalone), fake a minimal Magento directory layout so the command
* can resolve its test directories.
*/
$fixtureRoot = sys_get_temp_dir() . '/parallel-tests-plus-fixture';

$testDirs = [
'dev/tests/unit',
'dev/tests/static/framework/tests/unit',
'dev/tests/integration/framework/tests/unit',
'dev/tests/integration',
'dev/tests/static',
'app/etc',
];

foreach ($testDirs as $relativeDir) {
$path = $fixtureRoot . '/' . $relativeDir;
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
}

file_put_contents($fixtureRoot . '/app/etc/vendor_path.php', "<?php\nreturn 'vendor';\n");

if (!defined('BP')) {
define('BP', $fixtureRoot);
}
1 change: 1 addition & 0 deletions Test/Unit/_files/mock_passthru.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2025 Mohamed EL Mrabet
* CleatSquad - https://cleatsquad.dev
Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@
"brianium/paratest": "^7.4",
"magento/module-developer": "^100.4"
},
"require-dev": {
"phpunit/phpunit": "^10.5 || ^11.0",
"phpstan/phpstan": "^1.0",
"friendsofphp/php-cs-fixer": "^3.0"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"allow-plugins": {
"magento/composer-dependency-version-audit-plugin": true
}
},
"scripts": {
"test": "phpunit --testsuite unit",
"phpstan": "phpstan analyse",
"cs-fixer": "php-cs-fixer fix --dry-run --diff"
}
}
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: 5
paths:
- Console
bootstrapFiles:
- .phpstan-bootstrap.php
11 changes: 11 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="Test/Unit/_files/bootstrap.php"
colors="true">
<testsuites>
<testsuite name="unit">
<directory>Test/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
1 change: 1 addition & 0 deletions registration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2025 Mohamed EL Mrabet
* CleatSquad - https://cleatsquad.dev
Expand Down
Loading