Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

test-magento2 for DDEV testing only

This repo is a fixture consumed by ddev/ddev's own test suite (pkg/ddevapp/ddevapp_test.go, the testpkgmagento2 case), which downloads a tagged release of this repo's .tarballs/* artifacts and expects these exact URLs to work in a fresh ddev magento2 project:

  • /junk.txtThis is a junk
  • /index.php/unicycle.html → contains unicycle
  • /media/catalog/product/u/n/unicycle.jpg → the product image

When you cut a new release here, the ddev/ddev test file's tag and tarball URLs (currently pinned to an old tag) need to be updated to match — that's a separate PR in ddev/ddev.

Current versions (as of this fixture's last rebuild)

  • Magento Open Source: 2.4.9
  • PHP: 8.4
  • Database: MariaDB 12.3
  • Search engine: OpenSearch (via the ddev/ddev-opensearch add-on — Magento dropped Elasticsearch support; older versions of this fixture used the ddev/ddev core Elasticsearch service)

To recreate

  1. Make sure .ddev/homeadditions/.composer/auth.json has valid repo.magento.com public/private keys under http-basic. This path is already wired up via web_environment: COMPOSER_HOME=... in .ddev/config.yaml, and the file is gitignored so keys never get committed. Get keys from your Adobe Commerce Marketplace account (Access Keys) if you don't have them.

  2. Delete the existing Magento source tree so ddev composer create-project can run again (see gotcha below):

    rm -rf app bin dev generated lib phpserver pub setup var vendor \
      .editorconfig .htaccess .htaccess.sample .php-cs-fixer.dist.php .user.ini \
      auth.json.sample CHANGELOG.md composer.json composer.lock COPYING.txt \
      grunt-config.json.sample Gruntfile.js.sample LICENSE_AFL.txt LICENSE.txt \
      nginx.conf.sample package.json.sample SECURITY.md
  3. Reconfigure DDEV (bump versions here as needed — check current requirements at https://experienceleague.adobe.com/en/docs/commerce-operations/installation-guide/system-requirements):

    ddev config --project-type=magento2 --docroot=pub --upload-dirs=media \
      --disable-settings-management --php-version=8.4 --database=mariadb:12.3
    rm -rf .ddev/elasticsearch .ddev/docker-compose.elasticsearch.yaml \
      .ddev/addon-metadata/elasticsearch
    ddev add-on get ddev/ddev-opensearch
    ddev start
  4. Gotcha: ddev composer create-project refuses to run unless the project root is (almost) empty. It hard-codes a skip-list of directories it ignores (.claude .ddev .devcontainer .DS_Store .git .idea .tarballs .vscode), but plain files at the root — including this README.md and .gitignore — are NOT on that list and will abort the command with 'X' is not allowed to be present. Temporarily move them out of the project root (e.g. to /tmp) before running create-project, then move them back afterward:

    mv README.md .gitignore /tmp/
    ddev composer create-project --repository https://repo.magento.com/ \
      magento/project-community-edition . --no-interaction
    mv /tmp/README.md /tmp/.gitignore .

    Also note: passing a subdirectory name (as the old ddev quickstart docs used to show) is rejected by current ddev with "Installing the project in the 'X' subdirectory is unsupported" — use . for the target directory.

  5. Install Magento:

    ddev magento setup:install --base-url="https://testpkgmagento2.ddev.site/" \
      --cleanup-database --db-host=db --db-name=db --db-user=db --db-password=db \
      --opensearch-host=opensearch --search-engine=opensearch --opensearch-port=9200 \
      --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
      --admin-user=admin --admin-password=Password123 --language=en_US
    ddev magento deploy:mode:set developer
    ddev magento module:disable Magento_TwoFactorAuth Magento_AdminAdobeImsTwoFactorAuth
    ddev config --disable-settings-management=false
    ddev magento setup:config:set --backend-frontname="admin_ddev" --no-interaction
  6. Create a simple product named unicycle with SKU unicycle and a picture named unicycle.jpg. You can do this by hand in the admin UI (Catalog → Products → Add Product → Simple Product) with a picture from https://m.media-amazon.com/images/I/715LWvYxcLL._AC_SY879_.jpg or anywhere else, or via the REST API, which is scriptable and was used to build this fixture:

    TOKEN=$(ddev exec -- curl -sk -X POST "https://testpkgmagento2.ddev.site/rest/V1/integration/admin/token" \
      -H "Content-Type: application/json" -d '{"username":"admin","password":"Password123"}' | jq -r .)
    
    ddev exec -- curl -sk -X POST "https://testpkgmagento2.ddev.site/rest/V1/products" \
      -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{
        "product": {"sku":"unicycle","name":"unicycle","attribute_set_id":4,
        "price":199.99,"status":1,"visibility":4,"type_id":"simple","weight":5,
        "extension_attributes":{"stock_item":{"qty":100,"is_in_stock":true}}}}'
    
    # Then base64-encode the image and POST it to
    # /rest/V1/products/unicycle/media as a media_gallery_entries "content" payload.

    The product's URL key must resolve to /index.php/unicycle.html and the uploaded image must land at pub/media/catalog/product/u/n/unicycle.jpgddev/ddev's test suite checks both paths literally.

  7. Add a junk file so the test suite has something trivial to fetch:

    echo "This is a junk" >pub/junk.txt
  8. Build the tarballs:

    VERSION=2.4.9
    mkdir -p .tarballs
    tar -czf .tarballs/testpkgmagento2_code_no_media.magento${VERSION}.tgz \
      --exclude=.ddev --exclude=.git --exclude=dev --exclude=var \
      --exclude=pub/media --exclude=pub/static --exclude=.tarballs \
      --exclude=app/etc/env.php --exclude=.idea --exclude=.vscode .
    ddev export-db --gzip=false --file=.tarballs/db.sql && \
      tar -czf .tarballs/testpkgmagento2.magento${VERSION}.db.tgz -C .tarballs db.sql && \
      rm .tarballs/db.sql
    tar -czf .tarballs/testpkgmagento2_files.magento${VERSION}.tgz -C pub/media .

    Why --exclude=pub/static matters: Magento's static-asset publisher, when running in Developer mode, materializes plain (unprocessed) static view files — vendor JS libraries, etc. — as symlinks with absolute target paths rooted at Magento's base path (/var/www/html inside any ddev container), e.g. pub/static/adminhtml/Magento/backend/en_US/requirejs/require.js -> /var/www/html/lib/web/requirejs/require.js. This is normal, intentional Magento behavior (not a bug in this repo's tar invocation, and not specific to any one Magento version) — it happens automatically the first time each asset is requested (e.g. by loading the admin login page). Because it symlinks to an absolute path, it only happens to work when re-extracted into another container that also mounts the project at /var/www/html (true for ddev, not guaranteed elsewhere), and tarring up symlinks at all is fragile. pub/static is a regenerable build artifact just like pub/media/var/generated, so the simplest fix is excluding it entirely — Magento rebuilds it on first request. (Note: bin/magento setup:static-content:deploy does NOT reproduce this — it always copies real files. The symlinks only appear via the lazy, on-request publishing pipeline in Developer mode.)

  9. Create an empty release tagged with $VERSION and upload the tarballs (gh CLI required):

    gh release create ${VERSION} --title ${VERSION} --notes "Magento ${VERSION}"
    gh release upload ${VERSION} .tarballs/*gz
  10. Update ddev/ddev's pkg/ddevapp/ddevapp_test.go (the testpkgmagento2 test case) to point SourceURL, DBTarURL, and FilesTarballURL at the new tag/filenames.

About

DDEV automated test sources for magento2, not for public use

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages