Commit b2c31b44 authored by Moshe Weitzman's avatar Moshe Weitzman

Test on Drupal 9 (latest stable) by default.

parent 2ad5d503
Pipeline #158427862 passed with stage
in 6 minutes and 3 seconds
......@@ -7,24 +7,34 @@ test:
DOCKER_DRIVER: overlay2
# https://github.com/docker/compose/issues/5696
COMPOSE_INTERACTIVE_NO_CLI: 1
SYMFONY_DEPRECATIONS_HELPER: weak
SYMFONY_DEPRECATIONS_HELPER: disabled
DRUPAL_CORE_CONSTRAINT: ^9
before_script:
- apk add --no-cache py-pip
# Pin docker-compose version to stop installation error https://gitlab.com/gitlab-com/support-forum/issues/4421
- pip install docker-compose~=1.23.0
- docker-compose up -d
script:
- docker-compose exec -T drupal composer install -n --prefer-dist
# Accept a constraint for Drupal core version.
- docker-compose exec -T drupal composer require --dev --no-update drupal/core-recommended:$DRUPAL_CORE_CONSTRAINT
- docker-compose exec -T drupal composer require --dev --no-update drupal/core-dev:$DRUPAL_CORE_CONSTRAINT
- docker-compose exec -T drupal composer require --dev --no-update drupal/core-composer-scaffold:$DRUPAL_CORE_CONSTRAINT
- docker-compose exec -T drupal composer install -n --prefer-dist --no-suggest --no-progress
- docker-compose exec -T drupal composer lint
- docker-compose exec -T drupal composer cs
- docker-compose exec -T drupal mkdir web/sites/simpletest
- docker-compose exec -T drupal composer si
# For easier debugging.
- docker-compose exec -T drupal vendor/bin/drush status
- docker-compose exec -T drupal chown -R www-data:www-data .
- docker-compose exec --env SYMFONY_DEPRECATIONS_HELPER=disabled -T drupal composer unit
- docker-compose exec --env SYMFONY_DEPRECATIONS_HELPER=$SYMFONY_DEPRECATIONS_HELPER -T drupal composer unit -- --log-junit web/sites/simpletest/browser_output/junit.xml
artifacts:
when: on_failure
expire_in: 5 mos
expire_in: 3 mos
expose_as: web-vendor-browser-output
reports:
junit: web/sites/simpletest/browser_output/junit.xml
paths:
- web/sites/simpletest/browser_output
- vendor
- web
......@@ -25,10 +25,10 @@
"behat/mink-selenium2-driver": "1.4.0 | 1.3.1 | 1.3.x-dev",
"composer/installers": "^1.2",
"dmore/chrome-mink-driver": "^2.6",
"drupal-composer/drupal-scaffold": "2.3.0",
"drupal/core-dev": "^8.8",
"drupal/core": "^[email protected]",
"drush/drush": "^9",
"drupal/core-composer-scaffold": "^9",
"drupal/core-dev": "^9",
"drupal/core-recommended": "^9",
"drush/drush": "^10",
"squizlabs/php_codesniffer": "^3.2",
"jakub-onderka/php-parallel-lint": "^1.0",
"zaporylie/composer-drupal-optimizations": "^1.0"
......@@ -43,7 +43,7 @@
"cs": "phpcs -n --report-full",
"cbf": "phpcbf --standard=PSR2 -n src tests",
"lint": "parallel-lint src tests",
"unit": "phpunit --debug --colors --bootstrap=src/bootstrap-fast.php --printer '\\Drupal\\Tests\\Listeners\\HtmlOutputPrinter' --log-junit web/sites/simpletest/browser_output/junit.xml tests",
"unit": "phpunit --verbose --colors --bootstrap=src/bootstrap-fast.php --printer '\\Drupal\\Tests\\Listeners\\HtmlOutputPrinter' tests",
"test": [
"@lint",
"@cs",
......@@ -58,6 +58,16 @@
"extra": {
"installer-paths": {
"web/core": ["type:drupal-core"]
},
"drupal-scaffold": {
"locations": {
"web-root": "web/"
},
"file-mapping": {
"[project-root]/.editorconfig": false,
"[project-root]/.gitattributes": false,
"[project-root]/.gitignore": false
}
}
}
}
......@@ -35,7 +35,7 @@ trait ScreenShotTrait
}
$current_url = Html::cleanCssIdentifier($this->getSession()->getCurrentUrl());
$base_filename = Html::cleanCssIdentifier($base_filename);
$filename = file_create_filename(uniqid() . '_' . $current_url . '_' . $base_filename . '.png', $directory);
$filename = $directory . DIRECTORY_SEPARATOR . (uniqid() . '_' . $current_url . '_' . $base_filename . '.png');
$screenshot = $this->getDriverInstance()->getScreenshot();
file_put_contents($filename, $screenshot);
}
......
......@@ -14,10 +14,17 @@
* slower but registers all the namespaces that Drupal tests expect.
*/
use Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter;
use weitzman\DrupalTestTraits\AddPsr4;
list($finder, $class_loader) = AddPsr4::add();
$root = $finder->getDrupalRoot();
// So that test cases may be simultaneously compatible with multiple major versions of PHPUnit.
$class_loader->addPsr4('Drupal\TestTools\\', "$root/core/tests");
if (class_exists('Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter')) {
ClassWriter::mutateTestBase($class_loader);
}
// Register more namespaces, as needed.
# $class_loader->addPsr4('Drupal\Tests\my_module\\', "$root/modules/custom/my_module/tests/src");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment