- πΊπΈUnited States trackleft2
In case this helps anyone who prefers using lando for local development.
name: migrate-tools recipe: drupal9 config: php: '7.4' via: apache:2.4 webroot: web database: mariadb:10.4 xdebug: false services: # Replaces default lando MariaDB image with arm64 (Apple M1) compatible one. # TODO: remove database service overrides once lando is updated. database: type: compose services: image: mariadb:10.4 command: docker-entrypoint.sh mariadbd restart: always ports: - '3306' environment: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'true' MARIADB_DATABASE: drupal9 MYSQL_DATABASE: drupal9 MARIADB_USER: drupal9 MARIADB_PASSWORD: drupal9 appserver: overrides: environment: SIMPLETEST_DB: 'mysql://drupal9:drupal9@database/drupal9' SIMPLETEST_BASE_URL: 'http://appserver' MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--disable-dev-shm-usage","--headless","--no-sandbox"],"w3c":false}},"http://chromedriver:4444/wd/hub"]' XDEBUG_MODE: debug volumes: # Don't share our host working directory as /app. We want /app empty for composer. - /app # Instead share our host working directory as a standalone package. - .:/usr/local/migrate_tools build: - git clone --depth 1 --branch 9.4.5 https://github.com/drupal/recommended-project.git /app - composer config repositories.localdev path /usr/local/migrate_tools - composer require --no-update liuggio/fastest:1.11.0 - composer require --no-update "behat/behat" - composer require --no-update "behat/mink:^1.8" - composer require --no-update "behat/mink-goutte-driver:^1.2" - composer require --no-update "behat/mink-selenium2-driver:^1.4" - composer require --no-update "phpspec/prophecy-phpunit:^2" - composer require --no-update "symfony/phpunit-bridge:^6.1" - composer require --no-update "mikey179/vfsstream" - composer require --no-update "phpunit/phpunit:^9.1" - composer require --no-update "drush/drush:>=11" - composer require --no-update "drupal/migrate_source_csv:>=3" - composer require --no-update "drupal/migrate_plus:>=5" - composer require --no-update drupal/migrate_tools:\*@dev - composer install - composer update chromedriver: type: compose services: image: seleniarm/standalone-chromium:4.1.4-20220429 command: /opt/bin/entry_point.sh tooling: # Provide a command to install Drupal. install: service: appserver cmd: - /app/vendor/bin/drush --root=/app/web site:install --account-mail=noreply@example.com --account-name=admin --account-pass=admin --db-url=mysql://drupal9:drupal9@database:3306/drupal9 -y --verbose - /app/vendor/bin/drush en -y migrate_tools # Provide Drush tooling to automatically know the Drupal root. drush: service: appserver cmd: /app/vendor/bin/drush --root=/app/web phpunit: service: appserver cmd: /app/vendor/bin/phpunit --configuration /app/web/modules/contrib/migrate_tools/phpunit.xml.dist /app/web/modules/contrib/migrate_tools
And the corresponding phpunit.xml.dist
<?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="/app/web/core/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> <coverage processUncoveredFiles="true"> <include> <directory>./modules</directory> </include> <exclude> <directory suffix="Test.php">./</directory> <directory suffix="TestBase.php">./</directory> </exclude> </coverage> <php> <!-- Set error reporting to E_ALL. --> <ini name="error_reporting" value="32767"/> <!-- Do not limit the amount of memory tests take to run. --> <ini name="memory_limit" value="-1"/> </php> <testsuites> <testsuite name="MigrateToolsTest"> <directory>./tests</directory> <directory>./modules</directory> </testsuite> </testsuites> <!-- Filter for coverage reports. --> </phpunit>
Once you have lando installed
Inside the folder where you cloned a copy of migrate_tools run
lando start
lando install
lando phpunit
Which outputs
β migrate_tools git:(6.0.x) β lando phpunit PHPUnit 9.6.7 by Sebastian Bergmann and contributors. .................................... 36 / 36 (100%) Time: 00:59.423, Memory: 10.00 MB OK (36 tests, 328 assertions)