### Setup Integration Test Configuration Example (PHP) Source: https://docs.warden.dev/configuration/magento2-testing Example configuration for running setup integration tests. This array defines database credentials, administrative details, and module enablement/disablement for the test environment. ```php return [ 'default' => [ 'db-host' => 'tmp-mysql', 'db-user' => 'root', 'db-password' => 'magento', 'db-name' => 'magento_integration_tests', 'db-prefix' => '', 'backend-frontname' => 'admin', 'admin-user' => 'admin', 'admin-password' => '123123q', 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, 'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME, 'enable-modules' => 'Magento_TestSetupModule2,Magento_TestSetupModule1,Magento_Backend', 'disable-modules' => 'all' ], 'checkout' => [ 'host' => 'tmp-mysql', 'username' => 'root', 'password' => 'magento', 'dbname' => 'magento_integration_tests' ], 'sales' => [ 'host' => 'tmp-mysql', 'username' => 'root', 'password' => 'magento', 'dbname' => 'magento_integration_tests' ] ]; ``` -------------------------------- ### Start Warden Project Environment Source: https://docs.warden.dev/environments/drupal Starts the Docker containers and associated services for the project environment defined in the `.env` file. If you encounter a 'Mounts denied' error, follow the error message's instructions and retry the command. ```bash warden env up ``` -------------------------------- ### Install Shopware 6 Application Source: https://docs.warden.dev/environments/shopware Installs the Shopware 6 application, including sample data, using the PSH (Project Setup) script. This command should be executed from within the project's shell environment after configuring the APP_URL. The default admin credentials are 'admin'/'shopware'. ```bash ./psh.phar install ``` -------------------------------- ### Start Shopware Project Environment Source: https://docs.warden.dev/environments/shopware Starts the Docker environment for the Shopware 6 project. This command provisions all necessary services defined in the .env file. If you encounter 'Mounts denied' errors, follow the error message instructions and retry. ```bash warden env up ``` -------------------------------- ### Install Warden via Homebrew Source: https://docs.warden.dev/installing Installs Warden and starts its services using the Homebrew package manager. This is the recommended method for macOS and Linux users. ```bash brew install wardenenv/warden/warden warden svc up ``` -------------------------------- ### Run All Setup Integration Tests (PHP) Source: https://docs.warden.dev/configuration/magento2-testing Execute all setup integration tests. This requires the full path to the setup integration phpunit.xml file. ```bash vendor/bin/phpunit -c $(pwd)/dev/tests/setup-integration/phpunit.xml ``` -------------------------------- ### Install Magento Application Source: https://docs.warden.dev/environments/magento2 Installs the Magento application with specified database, search engine, caching, and session configurations. This command sets up the core application and its dependencies. ```bash ## Install Application bin/magento setup:install \ --backend-frontname=backend \ --amqp-host=rabbitmq \ --amqp-port=5672 \ --amqp-user=guest \ --amqp-password=guest \ --db-host=db \ --db-name=magento \ --db-user=magento \ --db-password=magento \ --search-engine=opensearch \ --opensearch-host=opensearch \ --opensearch-port=9200 \ --opensearch-index-prefix=magento2 \ --opensearch-enable-auth=0 \ --opensearch-timeout=15 \ --http-cache-hosts=varnish:80 \ --session-save=redis \ --session-save-redis-host=redis \ --session-save-redis-port=6379 \ --session-save-redis-db=2 \ --session-save-redis-max-concurrency=20 \ --cache-backend=redis \ --cache-backend-redis-server=redis \ --cache-backend-redis-db=0 \ --cache-backend-redis-port=6379 \ --page-cache=redis \ --page-cache-redis-server=redis \ --page-cache-redis-db=1 \ --page-cache-redis-port=6379 ## Configure Application bin/magento config:set --lock-env web/unsecure/base_url \ ``` -------------------------------- ### Alternative Warden Installation via Git Clone Source: https://docs.warden.dev/installing Installs Warden by cloning the repository directly and adding it to the system's PATH. This method is useful when Homebrew is not available or for contributing to Warden. ```bash sudo mkdir /opt/warden sudo chown $(whoami) /opt/warden git clone -b main https://github.com/wardenenv/warden.git /opt/warden echo 'export PATH="/opt/warden/bin:$PATH"' >> ~/.bashrc PATH="/opt/warden/bin:$PATH" warden svc up ``` -------------------------------- ### Create Project Directory and Navigate Source: https://docs.warden.dev/environments/drupal This snippet demonstrates how to create a new directory for your Drupal project and then navigate into it. This is the initial step for setting up a new local development environment. ```bash mkdir -p ~/Sites/exampleproject cd ~/Sites/exampleproject ``` -------------------------------- ### Tear Down Project Environment Source: https://docs.warden.dev/environments/shopware Completely destroys the 'exampleproject' environment created by Warden. This command removes the project's Docker containers, volumes, and network configurations, freeing up resources. Use this command to clean up a local development setup. ```bash warden env down -v ``` -------------------------------- ### Launch Shell Session with Warden Source: https://docs.warden.dev/usage Starts a shell session within the project environment's php-fpm container, allowing direct interaction with the project's services. ```bash warden shell ``` -------------------------------- ### Import Database with Warden Source: https://docs.warden.dev/usage Imports a SQL database dump into the Warden environment. It supports compressed files using `pv` and `gunzip`. If `pv` is not installed, `cat` can be used as an alternative. ```bash pv /path/to/dump.sql.gz | gunzip -c | warden db import ``` -------------------------------- ### Warden Installation on Windows via WSL2 Source: https://docs.warden.dev/installing Installs Warden on Windows using the Windows Subsystem for Linux (WSL2). This involves setting up WSL2, installing Homebrew within it, and then installing Warden. ```bash wsl /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" brew install wardenenv/warden/warden warden svc up ``` -------------------------------- ### Enter Project Shell and Configure App URL Source: https://docs.warden.dev/environments/shopware Launches a shell within the 'php-fpm' Docker container for the project and sets the Shopware application URL. The APP_URL is configured in the .psh.yaml.override file, which is used by the PSH script for installation. ```bash warden shell echo $'const:\n APP_URL: "https://app.exampleproject.test"\n' > .psh.yaml.override ``` -------------------------------- ### Initialize Magento Project Source Files Source: https://docs.warden.dev/environments/magento2 Initializes the Magento project source files using Composer and then moves them to the web root. It also cleans up the temporary directory. ```bash META_PACKAGE=magento/project-community-edition META_VERSION=2.4.x composer create-project --repository-url=https://repo.magento.com/ \ "${META_PACKAGE}" /tmp/exampleproject "${META_VERSION}" rsync -a /tmp/exampleproject/ /var/www/html/ rm -rf /tmp/exampleproject/ ``` -------------------------------- ### Initialize Drupal Project and Move Files Source: https://docs.warden.dev/environments/drupal Initializes a new Drupal project using Composer's `create-project` command and then synchronizes the project files into the web server's document root (`/var/www/html/`). Temporary files are removed afterward. ```bash composer create-project drupal/recommended-project /tmp/exampleproject rsync -a /tmp/exampleproject/ /var/www/html/ rm -rf /tmp/exampleproject/ ``` -------------------------------- ### Clone Shopware Development Template Source: https://docs.warden.dev/environments/shopware Clones the official Shopware development template into the './webroot' directory of your project. This command requires Git to be installed and configured on your host machine. Ensure you have SSH access to the GitHub repository. ```bash git clone git@github.com:shopware/development.git ./webroot ``` -------------------------------- ### Install Javascript Test Dependencies (NPM) Source: https://docs.warden.dev/configuration/magento2-testing Within the Warden shell, use `npm install` to install the necessary Node.js dependencies for running JavaScript unit tests. Ensure you are within the `php-fpm` container before executing this command. ```bash npm install ``` -------------------------------- ### Initialize Warden Environment Configuration Source: https://docs.warden.dev/environments/magento2 Initializes the Warden environment by creating a `.env` file with project-specific configurations for Warden and Docker. This file is crucial for defining project settings and services. ```bash warden env-init exampleproject magento2 ``` -------------------------------- ### Tear Down Warden Environment Source: https://docs.warden.dev/environments/drupal Completely destroys the current Warden environment, including all associated Docker containers and volumes. This command is useful for cleaning up and starting fresh. ```bash warden env down -v ``` -------------------------------- ### Troubleshoot Node Package Installation (Bash) Source: https://docs.warden.dev/configuration/magento2-testing If encountering issues with Node package installations, remove the `node_modules` directory and `package-lock.json` file, then retry `npm install`. This ensures a clean installation. ```bash rm -rf node_modules/ package-lock.json && npm install ``` -------------------------------- ### Configure Project Webroot in .env Source: https://docs.warden.dev/environments/shopware Modifies the .env file to set the webroot to './webroot'. This is crucial for preventing the Shopware installer from overwriting Warden's environment configuration. The command uses Perl for in-place editing of the specified file. ```bash perl -pi -e 's#^WARDEN_WEB_ROOT.*#WARDEN_WEB_ROOT=/webroot#' .env ``` -------------------------------- ### Initialize Warden Environment Configuration Source: https://docs.warden.dev/environments/drupal Initializes the Warden environment for a new project by creating a `.env` file. This file contains essential configurations for Warden and Docker to manage the project's environment, including database, PHP, and Node.js versions. It's recommended to commit this file to your version control system. ```bash warden env-init exampleproject drupal ``` -------------------------------- ### Sign SSL Certificate for Project Domain Source: https://docs.warden.dev/environments/shopware Generates and signs an SSL certificate for the project's domain. The domain name provided to this command must match the `TRAEFIK_DOMAIN` value in the project's .env file. This ensures secure access to the local development environment. ```bash warden sign-certificate exampleproject.test ``` -------------------------------- ### Initialize Project Environment with Warden Source: https://docs.warden.dev/environments/shopware Initializes a new project environment for Shopware 6 using Warden. This command generates a .env file with project-specific configurations for Warden and Docker, including service versions and domain names. Ensure Warden is already running before executing this command. ```bash mkdir -p ~/Sites/exampleproject cd ~/Sites/exampleproject warden env-init exampleproject shopware ``` -------------------------------- ### Configure Magento Installation for API Tests Source: https://docs.warden.dev/configuration/magento2-testing This snippet shows how to configure the Magento installation for API functional tests by defining database, AMQP, Redis, and basic Magento settings. This configuration is used when setting up the integration test environment. ```php return [ 'db-host' => 'tmp-mysql', 'db-user' => 'root', 'db-password' => 'magento', 'db-name' => 'magento_integration_tests', 'cleanup-database' => true, 'amqp-host' => 'rabbitmq', 'amqp-port' => '5672', 'amqp-user' => 'guest', 'amqp-password' => 'guest', 'session-save' => 'redis', 'session-save-redis-host' => 'redis', 'session-save-redis-port' => 6379, 'session-save-redis-db' => 2, 'session-save-redis-max-concurrency' => 20, 'cache-backend' => 'redis', 'cache-backend-redis-server' => 'redis', 'cache-backend-redis-db' => 0, 'cache-backend-redis-port' => 6379, 'page-cache' => 'redis', 'page-cache-redis-server' => 'redis', 'page-cache-redis-db' => 1, 'page-cache-redis-port' => 6379, 'language' => 'en_US', 'timezone' => 'America/Los_Angeles', 'currency' => 'USD', 'backend-frontname' => 'backend', 'base-url' => 'https://app.magento2.test/', 'use-secure' => '1', 'use-rewrites' => '1', 'admin-lastname' => 'Admin', 'admin-firstname' => 'Admin', 'admin-email' => 'admin@example.com', 'admin-user' => 'admin', 'admin-password' => '123123q', 'admin-use-security-key' => '0', 'sales-order-increment-prefix' => time(), ]; ``` -------------------------------- ### Sign SSL Certificate for Local Development Source: https://docs.warden.dev/environments/drupal Signs an SSL certificate required for the local development environment. The input domain name should match the `TRAEFIK_DOMAIN` value specified in the `.env` file to ensure proper SSL configuration for your application. ```bash warden sign-certificate exampleproject.test ``` -------------------------------- ### Configure Magento Base URL and Security Settings Source: https://docs.warden.dev/environments/magento2 Sets the secure base URL, offloader header, and enables secure usage in frontend and adminhtml. It also configures SEO rewrites and disables static file signing. ```bash bin/magento config:set --lock-env web/secure/base_url \ "https://${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}/" bin/magento config:set --lock-env web/secure/offloader_header X-Forwarded-Proto bin/magento config:set --lock-env web/secure/use_in_frontend 1 bin/magento config:set --lock-env web/secure/use_in_adminhtml 1 bin/magento config:set --lock-env web/seo/use_rewrites 1 bin/magento config:set --lock-env dev/static/sign 0 ``` -------------------------------- ### Magento 2 Grunt Commands for LiveReload Development Source: https://docs.warden.dev/configuration/livereload These Grunt commands are used within the Warden shell for Magento 2 development with LiveReload. 'grunt clean' removes old build artifacts, 'grunt exec:blank' and 'grunt less:blank' rebuild the project theme, and 'grunt watch' starts the LiveReload server for continuous monitoring of file changes. ```shell grunt clean grunt exec:blank grunt less:blank ``` ```shell grunt watch ``` -------------------------------- ### Configure Magento Cache and Indexers Source: https://docs.warden.dev/environments/magento2 Sets up full page cache application and TTL, enables the EAV indexer for catalog search, and then disables block HTML and full page caches before flushing all caches and reindexing. ```bash bin/magento config:set --lock-env system/full_page_cache/caching_application 2 bin/magento config:set --lock-env system/full_page_cache/ttl 604800 bin/magento config:set --lock-env catalog/search/enable_eav_indexer 1 bin/magento deploy:mode:set -s developer bin/magento cache:disable block_html full_page bin/magento indexer:reindex bin/magento cache:flush ``` -------------------------------- ### Skip Environment Service Starts in .env Source: https://docs.warden.dev/environments/customizing Prevent specific services like the database or Redis from starting by setting their respective `WARDEN_` variables to `0` in the `.env` file. This is useful for development scenarios where you might want to use external services or manage these components manually. Apply changes with `warden env up`. ```dotenv WARDEN_DB=0 WARDEN_REDIS=0 ``` -------------------------------- ### Custom PHP Configuration Example Source: https://docs.warden.dev/environments/customizing Define custom PHP configurations by creating a `zz-config.ini` file within the `/.warden/php/` directory. This file allows you to override default `php.ini` settings, such as `error_reporting`, `date.timezone`, `memory_limit`, and `upload_max_filesize`. These settings are merged with or override the default configurations. ```ini error_reporting=(E_ALL ^ E_DEPRECATED) date.timezone = America/New_York memory_limit = 4G post_max_size = 50M upload_max_filesize = 50M ``` -------------------------------- ### Generate Magento Admin User and Configure 2FA (OTP) Source: https://docs.warden.dev/environments/magento2 Creates a local admin user with a generated password and configures Google Authenticator 2FA. It generates a TFA secret, constructs an OTPAuth URL, and saves the secret to Magento configuration. Includes commands to print credentials, QR code URL, and a one-time code. ```bash ADMIN_PASS="$(pwgen -n1 16)" ADMIN_USER=localadmin bin/magento admin:user:create \ --admin-password="${ADMIN_PASS}" \ --admin-user="${ADMIN_USER}" \ --admin-firstname="Local" \ --admin-lastname="Admin" \ --admin-email="${ADMIN_USER}@example.com" printf "u: %s\np: %s\n" "${ADMIN_USER}" "${ADMIN_PASS}" TFA_SECRET=$(python3 -c "import base64; print(base64.b32encode(bytearray('$(pwgen -A1 128)', 'ascii')).decode('utf-8'))" | sed 's/=*$//') OTPAUTH_URL=$(printf "otpauth://totp/%s%%3Alocaladmin%%40example.com?issuer=%s&secret=%s" \ "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TFA_SECRET}" ) bin/magento config:set --lock-env twofactorauth/general/force_providers google bin/magento security:tfa:google:set-secret "${ADMIN_USER}" "${TFA_SECRET}" printf "%s\n\n" "${OTPAUTH_URL}" printf "2FA Authenticator Codes:\n%s\n" "$(oathtool -s 30 -w 10 --totp --base32 "${TFA_SECRET}")" segno "${OTPAUTH_URL}" -s 4 -o "pub/media/${ADMIN_USER}-totp-qr.png" printf "%s\n\n" "https://${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}/media/${ADMIN_USER}-totp-qr.png?t=$(date +%s)" ``` -------------------------------- ### Monitor Database Process List with Warden Source: https://docs.warden.dev/usage Continuously monitors the database process list by executing 'show processlist' every 3 seconds. This is useful for identifying long-running or problematic database queries. ```bash watch -n 3 "warden db connect -A -e 'show processlist'" ``` -------------------------------- ### Configure Ubuntu resolvconf for Permanent DNS Entries Source: https://docs.warden.dev/configuration/dns-resolver This process configures the resolvconf service on Ubuntu to add permanent DNS entries. It involves installing resolvconf, editing the base configuration file, and restarting the network manager. ```bash sudo apt update && sudo apt install resolvconf ``` ```bash search home net nameserver 127.0.0.1 nameserver 1.1.1.1 nameserver 1.0.0.1 ``` ```bash sudo service network-manager restart ``` -------------------------------- ### Configure Global Composer Credentials Source: https://docs.warden.dev/environments/magento2 Configures global Composer credentials for accessing private repositories like Magento Marketplace. Requires Adobe Commerce Marketplace account credentials (Public key as username, Private key as password). ```bash composer global config http-basic.repo.magento.com ``` -------------------------------- ### Configure LiveReload JS in Magento 2 app/etc/env.php Source: https://docs.warden.dev/configuration/livereload This PHP code snippet shows how to merge the LiveReload JavaScript tag into the Magento 2 application's environment configuration file (app/etc/env.php). It ensures the LiveReload script is included in the footer of the site, allowing for live updates during development. ```php [ 'default' => [ 'design' => [ 'footer' => [ 'absolute_footer' => '' ] ] ] ] ]; ``` -------------------------------- ### Start and Stop Warden Environment Source: https://docs.warden.dev/usage Commands to control the lifecycle of the Warden environment. 'warden env stop' halts all running services, while 'warden env start' restarts a stopped environment. ```bash warden env stop ``` ```bash warden env start ``` -------------------------------- ### Update PHP-FPM Entrypoint for PEM File Mounting in Warden Source: https://docs.warden.dev/changelog Modifies the entrypoint script in PHP-FPM Docker images to support mounting PEM certificate files into the `/etc/pki/ca-trust/source/anchors` directory. This is useful for custom certificate authorities. ```bash # Example: Mounting PEM files into /etc/pki/ca-trust/source/anchors ``` -------------------------------- ### Run All Integration Tests (PHP) Source: https://docs.warden.dev/configuration/magento2-testing Execute all integration tests defined in the phpunit.xml file. Ensure you provide the full, absolute path to the configuration file. ```bash vendor/bin/phpunit -c $(pwd)/dev/tests/integration/phpunit.xml ``` -------------------------------- ### Flush Varnish Cache with Warden Source: https://docs.warden.dev/usage Executes the `varnishadm` command within the varnish container to ban all cached content, effectively flushing the entire varnish cache. ```bash warden env exec -T varnish varnishadm 'ban req.url ~ .' ``` -------------------------------- ### Monitor Redis Statistics with Warden Source: https://docs.warden.dev/usage Runs Redis in continuous statistics mode, providing real-time insights into Redis performance and memory usage directly from the command line. ```bash warden redis --stat ``` -------------------------------- ### Tail Varnish Activity Log with Warden Source: https://docs.warden.dev/usage Executes the `varnishlog` command within the varnish container to display real-time activity. This helps in debugging varnish caching behavior. ```bash warden env exec -T varnish varnishlog ``` -------------------------------- ### Configure Traefik Routing for Subdomains in Warden Source: https://docs.warden.dev/changelog Enhances Traefik configuration to route traffic for both main domains (e.g., example.com) and subdomains (e.g., *.example.com) to the application. This simplifies routing configurations. ```yaml # Traefik routing rules update ``` -------------------------------- ### Configure Integration Test Database (PHP) Source: https://docs.warden.dev/configuration/magento2-testing Create the `etc/install-config-mysql.php` file based on its distribution. This PHP array configures the database connection and other settings required for running integration tests, such as host, user, password, and database name. ```php return [ 'db-host' => 'tmp-mysql', 'db-user' => 'root', 'db-password' => 'magento', 'db-name' => 'magento_integration_tests', 'backend-frontname' => 'backend', 'search-engine' => 'elasticsearch7', 'elasticsearch-host' => 'elasticsearch', 'elasticsearch-port' => 9200, 'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, 'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME, 'amqp-host' => 'rabbitmq', 'amqp-port' => '5672', 'amqp-user' => 'guest', 'amqp-password' => 'guest', 'session-save' => 'redis', 'session-save-redis-host' => 'redis', 'session-save-redis-port' => 6379, 'session-save-redis-db' => 2, 'session-save-redis-max-concurrency' => 20, 'cache-backend' => 'redis', 'cache-backend-redis-server' => 'redis', 'cache-backend-redis-db' => 0, 'cache-backend-redis-port' => 6379, 'page-cache' => 'redis', 'page-cache-redis-server' => 'redis', 'page-cache-redis-db' => 1, 'page-cache-redis-port' => 6379, ]; ``` -------------------------------- ### Enable Explicit Defaults for Timestamp in Magento2 DB Settings (Warden) Source: https://docs.warden.dev/changelog Adds `explicit_defaults_for_timestamp=on` to the `db` settings for Magento2 environments. This ensures accurate timestamp handling, resolving issues with `setup:db:status` reporting. ```ini explicit_defaults_for_timestamp=on ``` -------------------------------- ### Connect and Flush Redis with Warden Source: https://docs.warden.dev/usage Provides commands to interact with the Redis service within the Warden environment. 'warden redis' connects to Redis, and 'warden redis flushall' clears all data. ```bash warden redis ``` ```bash warden redis flushall ``` -------------------------------- ### Enable ionCube Loader in Warden Source: https://docs.warden.dev/configuration/xdebug Configuration overrides for the `php-debug` service in Warden to enable the ionCube Loader extension. This involves volume mounting a custom INI file. ```yaml ./.warden/warden-env.yml services: php-debug: volumes: - ./.warden/php.d/01-ioncube-loader.ini:/etc/php.d/01-ioncube-loader.ini ``` ```ini ./.warden/php.d/01-ioncube-loader.ini zend_extension=ioncube_loader.so; ``` -------------------------------- ### Tail Warden Environment Logs Source: https://docs.warden.dev/usage Streams the last lines of specified log files for the Warden environment in real-time. It supports tailing multiple logs like nginx and php-fpm logs. ```bash warden env logs --tail 0 -f nginx php-fpm php-debug ``` -------------------------------- ### Fix Grunt Jasmine Issues (Bash) Source: https://docs.warden.dev/configuration/magento2-testing To resolve issues with `jasmine` tests, copy `package.json.sample` to `package.json`, remove `node_modules` and `package-lock.json`, and then run `npm install`. This command corrects potential version conflicts with `grunt-contrib-jasmine`. ```bash cp package.json.sample package.json && rm -rf node_modules/ package-lock.json && npm install ``` -------------------------------- ### Enable SourceGuardian in Warden Source: https://docs.warden.dev/configuration/xdebug Configuration overrides for the `php-debug` service in Warden to enable the SourceGuardian extension. This involves volume mounting a custom INI file. ```yaml ./.warden/warden-env.yml services: php-debug: volumes: - ./.warden/php.d/15-sourceguardian.ini:/etc/php.d/15-sourceguardian.ini ``` ```ini ./.warden/php.d/15-sourceguardian.ini: extension=sourceguardian.so ``` -------------------------------- ### Deploy Static Content (Magento CLI) Source: https://docs.warden.dev/configuration/magento2-testing Run the Magento CLI command to deploy static content, which is often a prerequisite for executing JavaScript tests. This command should be executed within the Warden shell. ```bash bin/magento setup:static-content:deploy -f ``` -------------------------------- ### Run Magento 2 Unit Tests (CLI) Source: https://docs.warden.dev/configuration/magento2-testing Execute unit tests using the PHPUnit command-line tool. You can run all tests defined in `phpunit.xml` or target specific directories by providing a path. ```bash vendor/bin/phpunit -c dev/tests/unit/phpunit.xml vendor/bin/phpunit -c dev/tests/unit/phpunit.xml {PATH TO TESTS} ``` -------------------------------- ### VSCode Xdebug Configuration Source: https://docs.warden.dev/configuration/xdebug VSCode launch configuration for listening to Xdebug connections. It specifies the debugger type, request mode, port, and path mappings between the host and container. ```json { "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9003, "pathMappings": { "/var/www/html": "${workspaceRoot}" } } ] } ``` -------------------------------- ### Run Specific Integration Tests Directory (PHP) Source: https://docs.warden.dev/configuration/magento2-testing Execute integration tests within a specific directory. This requires providing the full path to the phpunit.xml file and the absolute path to the desired test directory. ```bash vendor/bin/phpunit -c $(pwd)/dev/tests/integration/phpunit.xml {ABSOLUTE PATH TO TESTS} ``` -------------------------------- ### Run API Functional Tests with PHPUnit Source: https://docs.warden.dev/configuration/magento2-testing Commands to execute API functional tests using PHPUnit. It shows how to run all tests defined in a PHPUnit configuration file and how to specify a particular test directory. ```bash vendor/bin/phpunit -c $(pwd)/dev/tests/api-functional/phpunit_{type}.xml vendor/bin/phpunit -c $(pwd)/dev/tests/api-functional/phpunit_{type}.xml {ABSOLUTE PATH TO TESTS} ``` -------------------------------- ### Define Magento 2 Run Codes and Types in PHP Source: https://docs.warden.dev/configuration/multipledomains_highlight=warden+env+yml This PHP script determines the Magento run code and type based on the HTTP host. It's placed in `app/etc/stores.php` and is crucial for multi-domain setups. It only modifies server parameters if they are not already set. ```php