Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0109fc5
feat: add command to copy files from vendor to theme
dermatz Feb 12, 2026
40b62e2
feat: add method to retrieve theme by code
dermatz Feb 12, 2026
8cb4e6d
fix: return proper CLI constants for failure and success cases
dermatz Feb 12, 2026
2e7968f
feat: enhance theme path resolution using ComponentRegistrar
dermatz Feb 12, 2026
af10b97
feat: add PHPUnit workflow and unit tests for VendorFileMapper
dermatz Feb 12, 2026
0d7f349
feat: improve file copy command with error handling and path normaliz…
dermatz Feb 12, 2026
4b8b47d
refactor: remove unused filesystem dependency and update type casting
dermatz Feb 12, 2026
37a421c
feat: add tests for copy from vendor functionality in workflows
dermatz Feb 13, 2026
3043585
feat: add ES_SKIP_CGROUPS_CHECK environment variable for Elasticsearch
dermatz Feb 13, 2026
38c12fc
fix: update Elasticsearch configuration for health checks
dermatz Feb 13, 2026
e057e78
feat: update Elasticsearch version and add new theme copy commands
dermatz Feb 13, 2026
0933eba
feat: add dry-run option to copy-from-vendor command for previews
dermatz Feb 13, 2026
0f429be
feat: update test for theme copy from vendor with real module template
dermatz Feb 13, 2026
5d0cc83
feat: simplify test for copy from vendor command in functional tests
dermatz Feb 13, 2026
a28eb2b
refactor: reorder detection patterns in VendorFileMapper for clarity
dermatz Feb 16, 2026
ca088d1
Apply suggestion from @Copilot
dermatz Feb 16, 2026
8df5fd0
Update src/Console/Command/Theme/CopyFromVendorCommand.php
dermatz Feb 16, 2026
ee34736
Update .github/workflows/functional-tests.yml
dermatz Feb 16, 2026
323447a
Update src/Service/VendorFileMapper.php
dermatz Feb 16, 2026
04e78e6
Update src/Console/Command/Theme/CopyFromVendorCommand.php
dermatz Feb 16, 2026
869537a
feat: add method to retrieve theme by code in ThemeList
dermatz Feb 16, 2026
3847442
feat: enhance VendorFileMapper with theme area validation and extraction
dermatz Feb 16, 2026
0c2eeb2
feat: implement copy command tests and update VendorFileMapper
dermatz Feb 16, 2026
aa6e8a5
docs: update testing guide for copy command with new test cases
dermatz Feb 16, 2026
49df7c8
test: enhance copy command tests with dynamic file discovery
dermatz Feb 16, 2026
a123d0b
feat: enhance file copy confirmation with improved prompt handling
dermatz Feb 17, 2026
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
25 changes: 18 additions & 7 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ jobs:
bin/magento mageforge:hyva:compatibility:check --show-all

echo "Third party only:"
bin/magento m:h:c:c --third-party-only
bin/magento mageforge:hyva:compatibility:check --third-party-only

echo "Detailed output:"
bin/magento m:h:c:c --show-all --detailed
bin/magento mageforge:hyva:compatibility:check --show-all --detailed

- name: Test Theme Cleaner
working-directory: magento2
Expand All @@ -139,7 +139,6 @@ jobs:
bin/magento mageforge:theme:clean --all --dry-run

echo "Test aliases:"
bin/magento m:t:c --help
bin/magento frontend:clean --help

- name: Test Theme Name Suggestions
Expand All @@ -155,11 +154,24 @@ jobs:
echo "CleanCommand with invalid name:"
bin/magento mageforge:theme:clean Magent/lum --dry-run || echo "Expected failure - suggestions shown"

- name: Test Inspector Status
- name: Test Copy From Vendor
working-directory: magento2
run: |
echo "=== Inspector Tests ==="
bin/magento mageforge:theme:inspector status
echo "=== Copy From Vendor Tests ==="

echo "Test help command:"
bin/magento mageforge:theme:copy-from-vendor --help

echo "Test alias help:"
bin/magento theme:copy --help

echo "Test dry-run without required arguments (expect validation failure but command should execute):"
bin/magento mageforge:theme:copy-from-vendor --dry-run || echo "Expected failure - missing or invalid arguments for copy-from-vendor"

echo "Test alias dry-run without required arguments (expect validation failure but alias should execute):"
bin/magento theme:copy --dry-run || echo "Expected failure - missing or invalid arguments for theme:copy alias"
Comment on lines +168 to +172
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test commands at lines 168-172 will fail because the 'file' argument is required (InputArgument::REQUIRED), but the test runs the command with only the --dry-run option and no file argument. Magento's Symfony Console will throw an error before executeCommand() is reached. The test should either provide a valid file path or expect the specific validation error message.

Suggested change
echo "Test dry-run without required arguments (expect validation failure but command should execute):"
bin/magento mageforge:theme:copy-from-vendor --dry-run || echo "Expected failure - missing or invalid arguments for copy-from-vendor"
echo "Test alias dry-run without required arguments (expect validation failure but alias should execute):"
bin/magento theme:copy --dry-run || echo "Expected failure - missing or invalid arguments for theme:copy alias"
echo "Test dry-run with placeholder file argument (command should execute without performing copy):"
bin/magento mageforge:theme:copy-from-vendor dummy-file --dry-run || echo "Expected failure - missing or invalid configuration for copy-from-vendor"
echo "Test alias dry-run with placeholder file argument (alias should execute without performing copy):"
bin/magento theme:copy dummy-file --dry-run || echo "Expected failure - missing or invalid configuration for theme:copy alias"

Copilot uses AI. Check for mistakes.

echo "✓ Copy from vendor command and alias available and basic execution paths exercised"

- name: Test Inspector Functionality
working-directory: magento2
Expand Down Expand Up @@ -496,7 +508,6 @@ jobs:
bin/magento mageforge:theme:build Magento/blank --verbose || echo "Build attempted (may need additional setup)"

echo "Test build aliases:"
bin/magento m:t:b --help
bin/magento frontend:build --help

- name: Test Summary
Expand Down
204 changes: 183 additions & 21 deletions .github/workflows/magento-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

opensearch:
image: opensearchproject/opensearch:2.11.0
ports:
- 9200:9200
elasticsearch:
image: elasticsearch:7.17.25
env:
discovery.type: single-node
plugins.security.disabled: true
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
xpack.security.enabled: false
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
ports:
- 9200:9200
options: --health-cmd="curl -s http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
Comment on lines +35 to +43
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job/matrix still configures Magento with --search-engine=opensearch and opensearch host/port, but the service container was switched to elasticsearch:7.17.25. This mismatch is very likely to break the workflow. Either keep the OpenSearch service for opensearch runs, or change the matrix/search-engine-name and setup:install flags to match Elasticsearch (and adjust host/port option names accordingly).

Copilot uses AI. Check for mistakes.

steps:
- name: Checkout code
Expand Down Expand Up @@ -136,22 +136,103 @@ jobs:
bin/magento mageforge:theme:inspector --help
bin/magento mageforge:hyva:compatibility:check --help
bin/magento mageforge:hyva:tokens --help
bin/magento mageforge:theme:copy-from-vendor --help

echo "Verify command aliases work:"
bin/magento m:s:v --help
bin/magento m:s:c --help
bin/magento m:t:l --help
bin/magento m:t:b --help
bin/magento m:t:w --help
bin/magento m:t:c --help
bin/magento m:h:c:c --help
bin/magento frontend:list --help
bin/magento frontend:build --help
bin/magento frontend:watch --help
bin/magento frontend:clean --help
bin/magento theme:copy --help
bin/magento hyva:check --help
bin/magento hyva:tokens --help

- name: Test Copy Command Functionality
working-directory: magento2
run: |
echo "Finding available test files..."

# Find a frontend template file from any core module
FRONTEND_FILE=$(find vendor/magento/module-*/view/frontend/templates -type f -name "*.phtml" 2>/dev/null | head -1)
if [ -z "$FRONTEND_FILE" ]; then
echo "No frontend template files found, trying layout files..."
FRONTEND_FILE=$(find vendor/magento/module-*/view/frontend/layout -type f -name "*.xml" 2>/dev/null | head -1)
fi

# Find a base template file
BASE_FILE=$(find vendor/magento/module-*/view/base/templates -type f -name "*.phtml" 2>/dev/null | head -1)
if [ -z "$BASE_FILE" ]; then
echo "No base template files found, trying web files..."
BASE_FILE=$(find vendor/magento/module-*/view/base/web -type f \( -name "*.js" -o -name "*.css" \) 2>/dev/null | head -1)
fi

# Find an etc file for negative test
ETC_FILE=$(find vendor/magento/module-catalog/etc -type f -name "*.xml" 2>/dev/null | head -1)

echo "Test files found:"
echo "Frontend: $FRONTEND_FILE"
echo "Base: $BASE_FILE"
echo "Etc: $ETC_FILE"
echo ""

if [ -n "$FRONTEND_FILE" ]; then
echo "Test 1: Copy frontend file to frontend theme (dry-run):"
bin/magento mageforge:theme:copy-from-vendor \
"$FRONTEND_FILE" \
Magento/luma \
--dry-run
echo "✓ Frontend to frontend mapping works"
echo ""
else
echo "Warning: No frontend file found for testing"
fi

if [ -n "$BASE_FILE" ]; then
echo "Test 2: Copy base file to frontend theme (dry-run):"
bin/magento mageforge:theme:copy-from-vendor \
"$BASE_FILE" \
Magento/blank \
--dry-run
echo "✓ Base to frontend mapping works"
echo ""
else
echo "Warning: No base file found for testing"
fi

if [ -n "$ETC_FILE" ]; then
echo "Test 3: Verify non-view file is rejected:"
if bin/magento mageforge:theme:copy-from-vendor \
"$ETC_FILE" \
Magento/luma \
--dry-run 2>&1 | grep -q "not under a view"; then
echo "✓ Non-view file correctly rejected"
else
echo "✗ Non-view file validation failed"
exit 1
fi
echo ""
else
echo "Warning: No etc file found for negative testing"
fi

if [ -n "$FRONTEND_FILE" ]; then
echo "Test 4: Verify cross-area mapping is rejected (frontend -> adminhtml):"
if bin/magento mageforge:theme:copy-from-vendor \
"$FRONTEND_FILE" \
Magento/backend \
--dry-run 2>&1 | grep -q "Cannot map file from area"; then
echo "✓ Cross-area mapping correctly rejected"
else
echo "✗ Cross-area validation failed"
exit 1
fi
echo ""
else
echo "Warning: No frontend file found for cross-area testing"
fi

echo "✓ All copy command tests passed!"

- name: Test Summary
run: |
echo "MageForge module compatibility test with Magento ${{ matrix.magento-version }} completed"
Expand Down Expand Up @@ -274,22 +355,103 @@ jobs:
bin/magento mageforge:theme:inspector --help
bin/magento mageforge:hyva:compatibility:check --help
bin/magento mageforge:hyva:tokens --help
bin/magento mageforge:theme:copy-from-vendor --help

echo "Verify command aliases work:"
bin/magento m:s:v --help
bin/magento m:s:c --help
bin/magento m:t:l --help
bin/magento m:t:b --help
bin/magento m:t:w --help
bin/magento m:t:c --help
bin/magento m:h:c:c --help
bin/magento frontend:list --help
bin/magento frontend:build --help
bin/magento frontend:watch --help
bin/magento frontend:clean --help
bin/magento theme:copy --help
bin/magento hyva:check --help
bin/magento hyva:tokens --help

- name: Test Copy Command Functionality
working-directory: magento2
run: |
echo "Finding available test files..."

# Find a frontend template file from any core module
FRONTEND_FILE=$(find vendor/magento/module-*/view/frontend/templates -type f -name "*.phtml" 2>/dev/null | head -1)
if [ -z "$FRONTEND_FILE" ]; then
echo "No frontend template files found, trying layout files..."
FRONTEND_FILE=$(find vendor/magento/module-*/view/frontend/layout -type f -name "*.xml" 2>/dev/null | head -1)
fi

# Find a base template file
BASE_FILE=$(find vendor/magento/module-*/view/base/templates -type f -name "*.phtml" 2>/dev/null | head -1)
if [ -z "$BASE_FILE" ]; then
echo "No base template files found, trying web files..."
BASE_FILE=$(find vendor/magento/module-*/view/base/web -type f \( -name "*.js" -o -name "*.css" \) 2>/dev/null | head -1)
fi

# Find an etc file for negative test
ETC_FILE=$(find vendor/magento/module-catalog/etc -type f -name "*.xml" 2>/dev/null | head -1)

echo "Test files found:"
echo "Frontend: $FRONTEND_FILE"
echo "Base: $BASE_FILE"
echo "Etc: $ETC_FILE"
echo ""

if [ -n "$FRONTEND_FILE" ]; then
echo "Test 1: Copy frontend file to frontend theme (dry-run):"
bin/magento mageforge:theme:copy-from-vendor \
"$FRONTEND_FILE" \
Magento/luma \
--dry-run
echo "✓ Frontend to frontend mapping works"
echo ""
else
echo "Warning: No frontend file found for testing"
fi

if [ -n "$BASE_FILE" ]; then
echo "Test 2: Copy base file to frontend theme (dry-run):"
bin/magento mageforge:theme:copy-from-vendor \
"$BASE_FILE" \
Magento/blank \
--dry-run
echo "✓ Base to frontend mapping works"
echo ""
else
echo "Warning: No base file found for testing"
fi

if [ -n "$ETC_FILE" ]; then
echo "Test 3: Verify non-view file is rejected:"
if bin/magento mageforge:theme:copy-from-vendor \
"$ETC_FILE" \
Magento/luma \
--dry-run 2>&1 | grep -q "not under a view"; then
echo "✓ Non-view file correctly rejected"
else
echo "✗ Non-view file validation failed"
exit 1
fi
echo ""
else
echo "Warning: No etc file found for negative testing"
fi

if [ -n "$FRONTEND_FILE" ]; then
echo "Test 4: Verify cross-area mapping is rejected (frontend -> adminhtml):"
if bin/magento mageforge:theme:copy-from-vendor \
"$FRONTEND_FILE" \
Magento/backend \
--dry-run 2>&1 | grep -q "Cannot map file from area"; then
echo "✓ Cross-area mapping correctly rejected"
else
echo "✗ Cross-area validation failed"
exit 1
fi
echo ""
else
echo "Warning: No frontend file found for cross-area testing"
fi

echo "✓ All copy command tests passed!"

- name: Test Summary
run: |
echo "MageForge module compatibility test with Magento 2.4.8 completed"
Loading
Loading