Skip to content

Commit 1df1f13

Browse files
MCLOUD-14501: Release cloud tools with PHP 8.5 support (#179)
1 parent b64afd5 commit 1df1f13

File tree

102 files changed

+5954
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+5954
-717
lines changed

INTEGRITY_TESTS_COMMANDS.md

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
# Integrity Tests - Command Cheat Sheet
2+
3+
## Quick Start
4+
5+
### Most Common Commands
6+
7+
```bash
8+
# Run all integrity tests (recommended)
9+
cd tests/unit && ../../vendor/bin/phpunit --testsuite Integrity --testdox
10+
11+
# Run from project root
12+
./vendor/bin/phpunit -c tests/unit/phpunit.xml.dist --testsuite Integrity --testdox
13+
14+
# Quick check (no formatting)
15+
cd tests/unit && ../../vendor/bin/phpunit --testsuite Integrity
16+
```
17+
18+
## All Commands
19+
20+
### 1) Run All Integrity Tests
21+
22+
```bash
23+
cd tests/unit
24+
../../vendor/bin/phpunit --testsuite Integrity
25+
```
26+
27+
**Expected output:**
28+
```
29+
Tests: 17, Assertions: 19, Skipped: 2
30+
Time: ~0.04 seconds
31+
```
32+
33+
### 2) Run with Pretty Output (TestDox)
34+
35+
```bash
36+
cd tests/unit
37+
../../vendor/bin/phpunit --testsuite Integrity --testdox
38+
```
39+
40+
**Shows:**
41+
- Test passed
42+
- Test failed
43+
- Test skipped
44+
45+
### 3) Run Specific Test Class
46+
47+
```bash
48+
cd tests/unit
49+
50+
# Config Structure Tests (4 tests)
51+
../../vendor/bin/phpunit ../../src/Test/Integrity/Testsuite/ConfigStructureTest.php
52+
53+
# Patch File Naming Tests (2 tests)
54+
../../vendor/bin/phpunit ../../src/Test/Integrity/Testsuite/PatchFileNamingTest.php
55+
56+
# Patches Directory Tests (4 tests)
57+
../../vendor/bin/phpunit ../../src/Test/Integrity/Testsuite/PatchesDirectoryTest.php
58+
59+
# Supported Versions Tests (7 tests)
60+
../../vendor/bin/phpunit ../../src/Test/Integrity/Testsuite/SupportedVersionsTest.php
61+
```
62+
63+
### 4) Run Specific Test Method
64+
65+
```bash
66+
cd tests/unit
67+
68+
# Test patches.json structure
69+
../../vendor/bin/phpunit --filter testPatchesJsonStructure
70+
71+
# Test file existence
72+
../../vendor/bin/phpunit --filter testAllReferencedPatchFilesExist
73+
74+
# Test version constraints
75+
../../vendor/bin/phpunit --filter testVersionConstraintsAreValid
76+
77+
# Test naming conventions
78+
../../vendor/bin/phpunit --filter testPatchFileNamingConventions
79+
```
80+
81+
### 5) List All Available Tests
82+
83+
```bash
84+
cd tests/unit
85+
../../vendor/bin/phpunit --testsuite Integrity --list-tests
86+
```
87+
88+
**Output:** List of all 17 tests
89+
90+
### 6) Run with Colors
91+
92+
```bash
93+
cd tests/unit
94+
../../vendor/bin/phpunit --testsuite Integrity --colors=always
95+
```
96+
97+
### 7) Debug Mode (Verbose)
98+
99+
```bash
100+
cd tests/unit
101+
../../vendor/bin/phpunit --testsuite Integrity --debug
102+
```
103+
104+
**Shows:** Detailed execution information
105+
106+
### 8) Stop on First Failure
107+
108+
```bash
109+
cd tests/unit
110+
../../vendor/bin/phpunit --testsuite Integrity --stop-on-failure
111+
```
112+
113+
**Useful for:** Fixing errors one at a time
114+
115+
### 9) Run All Tests (Unit + Integrity)
116+
117+
```bash
118+
cd tests/unit
119+
../../vendor/bin/phpunit
120+
```
121+
122+
**Runs:** Both Unit and Integrity test suites
123+
124+
### 10) Generate Coverage Report
125+
126+
```bash
127+
cd tests/unit
128+
../../vendor/bin/phpunit --testsuite Integrity --coverage-html ../../var/coverage
129+
```
130+
131+
**View report:**
132+
```bash
133+
open ../../var/coverage/index.html
134+
```
135+
136+
## Test Results Explained
137+
138+
### Green Dot (.)
139+
Test passed successfully
140+
141+
### Red F
142+
Test failed
143+
144+
### Yellow S
145+
Test skipped (usually a warning, not a failure)
146+
147+
### D
148+
Deprecation notice (can be ignored for now)
149+
150+
## Common Use Cases
151+
152+
### Before Committing Changes
153+
154+
```bash
155+
# Quick validation
156+
cd tests/unit && ../../vendor/bin/phpunit --testsuite Integrity
157+
```
158+
159+
### After Editing patches.json
160+
161+
```bash
162+
# Validate JSON structure
163+
cd tests/unit && ../../vendor/bin/phpunit --filter ConfigStructureTest
164+
```
165+
166+
### After Adding New Patch File
167+
168+
```bash
169+
# Check file exists and naming is correct
170+
cd tests/unit && ../../vendor/bin/phpunit --filter testAllReferencedPatchFilesExist
171+
cd tests/unit && ../../vendor/bin/phpunit --filter testPatchFileNamingConventions
172+
```
173+
174+
### After Changing Version Constraints
175+
176+
```bash
177+
# Validate semver constraints
178+
cd tests/unit && ../../vendor/bin/phpunit --filter testVersionConstraintsAreValid
179+
```
180+
181+
## One-Liner Commands (Copy & Paste)
182+
183+
```bash
184+
# From project root - all tests with pretty output
185+
./vendor/bin/phpunit -c tests/unit/phpunit.xml.dist --testsuite Integrity --testdox
186+
187+
# From project root - quick check
188+
./vendor/bin/phpunit -c tests/unit/phpunit.xml.dist --testsuite Integrity
189+
190+
# From project root - specific test
191+
./vendor/bin/phpunit -c tests/unit/phpunit.xml.dist --filter testPatchesJsonStructure
192+
193+
# From tests/unit directory - most common
194+
cd tests/unit && ../../vendor/bin/phpunit --testsuite Integrity --testdox
195+
```
196+
197+
## Troubleshooting
198+
199+
### Error: "Could not find file"
200+
**Solution:** Make sure you're in the correct directory
201+
```bash
202+
cd /opt/homebrew/var/www/magento-cloud-patches/tests/unit
203+
```
204+
205+
### Error: "No tests executed"
206+
**Solution:** Check the testsuite name (case-sensitive)
207+
```bash
208+
../../vendor/bin/phpunit --testsuite Integrity # Correct
209+
../../vendor/bin/phpunit --testsuite integrity # Wrong
210+
```
211+
212+
### Error: "Class not found"
213+
**Solution:** Run composer install
214+
```bash
215+
cd /opt/homebrew/var/www/magento-cloud-patches
216+
composer install
217+
```
218+
219+
## Requirements
220+
221+
- PHP 8.1 or higher
222+
- Composer dependencies installed
223+
- No Docker required
224+
- No Magento installation required
225+
226+
## Performance
227+
228+
**Integrity Tests:**
229+
- 17 tests total
230+
- ~0.04 seconds execution time
231+
- Minimal memory usage (~8 MB)
232+
233+
234+
## Quick Reference Table
235+
236+
| Command | Purpose | Speed |
237+
|---------|---------|-------|
238+
| `--testsuite Integrity` | All integrity tests | Fast |
239+
| `--testdox` | Pretty output | Fast |
240+
| `--filter <name>` | Specific test | Very fast |
241+
| `--list-tests` | Show available tests | Very fast |
242+
| `--debug` | Verbose output | Fast |
243+
| `--stop-on-failure` | Stop on first error | Fast |
244+
| `--coverage-html` | Coverage report | Slow |
245+
246+
## What Each Test Validates
247+
248+
### ConfigStructureTest (4 tests)
249+
- patches.json is valid JSON
250+
- JSON has correct structure
251+
- All referenced files exist
252+
- Version constraints are valid semver
253+
254+
### PatchFileNamingTest (2 tests)
255+
- Files follow naming conventions
256+
- No duplicate references (warning only)
257+
258+
### PatchesDirectoryTest (4 tests)
259+
- patches/ directory exists
260+
- Directory contains patch files
261+
- All files are referenced
262+
- File quality checks (warning only)
263+
264+
### SupportedVersionsTest (7 tests)
265+
- Covers Magento 2.4.4+
266+
- Covers PHP 8.1+ versions
267+
- Major versions: 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8
268+
269+
---
270+
271+
**Pro Tip:** Add this to your bash/zsh aliases for quick access:
272+
273+
```bash
274+
# Add to ~/.bashrc or ~/.zshrc
275+
alias integrity='cd tests/unit && ../../vendor/bin/phpunit --testsuite Integrity --testdox'
276+
277+
# Usage:
278+
cd /opt/homebrew/var/www/magento-cloud-patches
279+
integrity
280+
```

composer.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-patches",
33
"description": "Provides critical fixes for Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "1.1.12",
5+
"version": "1.1.13",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -32,7 +32,7 @@
3232
"codeception/module-rest": "^1.2 || ^3.0",
3333
"consolidation/robo": "^1.2 || ^3.0 || ^4.0 || ^5.0",
3434
"phpmd/phpmd": "@stable",
35-
"phpunit/phpunit": "^10.0",
35+
"phpunit/phpunit": "^10.0 || ^12.0",
3636
"squizlabs/php_codesniffer": "^3.0"
3737
},
3838
"bin": [
@@ -46,14 +46,16 @@
4646
}
4747
},
4848
"scripts": {
49-
"test": [
50-
"@phpcs",
51-
"@phpmd",
52-
"@phpunit"
49+
"test:all": [
50+
"@test:phpcs",
51+
"@test:phpmd",
52+
"@test:unit",
53+
"@test:integrity"
5354
],
54-
"phpcs": "phpcs src --standard=tests/static/phpcs-ruleset.xml -p -n",
55-
"phpmd": "phpmd src xml tests/static/phpmd-ruleset.xml",
56-
"phpunit": "phpunit --configuration tests/unit"
55+
"test:phpcs": "phpcs src --standard=tests/static/phpcs-ruleset.xml -p -n",
56+
"test:phpmd": "phpmd src xml tests/static/phpmd-ruleset.xml",
57+
"test:unit": "phpunit --configuration tests/unit --testsuite Unit",
58+
"test:integrity": "phpunit --configuration tests/unit --testsuite Integrity --testdox"
5759
},
5860
"config": {
5961
"sort-packages": true,

config/services.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@
6666
<service id="Magento\CloudPatches\Command\Process\Renderer">
6767
<argument key="$statusPool" type="service" id="statusPool"/>
6868
</service>
69+
<service id="Magento\CloudPatches\Command\Process\VerifyPatches">
70+
<argument key="$patchVerifier" type="service" id="Magento\CloudPatches\Patch\Verification\PatchVerifier"/>
71+
</service>
72+
<service id="Magento\CloudPatches\Patch\Verification\PatchVerifier">
73+
<argument key="$statusPool" type="service" id="statusPool"/>
74+
</service>
75+
<service id="Magento\CloudPatches\Patch\Verification\VerificationReport" autowire="false"/>
6976
<service id="Magento\CloudPatches\Command\Process\Action\ActionPool" autowire="false"/>
7077
<service id="ApplyOptionalActionPool" class="Magento\CloudPatches\Command\Process\Action\ActionPool">
7178
<argument key="$actions" type="collection">

src/ApplicationEce.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Psr\Container\ContainerInterface;
1313

1414
/**
15-
* @inheritdoc
15+
* @inheritDoc
1616
*/
1717
class ApplicationEce extends \Symfony\Component\Console\Application
1818
{
@@ -35,14 +35,15 @@ public function __construct(ContainerInterface $container)
3535
}
3636

3737
/**
38-
* @inheritdoc
38+
* @inheritDoc
3939
*/
4040
protected function getDefaultCommands(): array
4141
{
4242
return array_merge(parent::getDefaultCommands(), [
4343
$this->container->get(Command\Ece\Apply::class),
4444
$this->container->get(Command\Ece\Revert::class),
45-
$this->container->get(Command\Status::class)
45+
$this->container->get(Command\Status::class),
46+
$this->container->get(Command\Verify::class)
4647
]);
4748
}
4849
}

0 commit comments

Comments
 (0)