Skip to content
Snippets Groups Projects
Unverified Commit a75a4b1b authored by Albert Albala's avatar Albert Albala Committed by GitHub
Browse files

Drop Drupal 8 support (#12)

parent 727fef62
Branches 2.x
Tags 2.0.0-beta1
No related merge requests found
FROM dcycle/drupal:8drush
# Make sure opcache is disabled during development so that our changes
# to PHP are reflected immediately.
RUN echo 'opcache.enable=0' >> /usr/local/etc/php/php.ini
RUN export COMPOSER_MEMORY_LIMIT=-1 && composer require drupal/devel
......@@ -14,7 +14,7 @@ services:
working_dir: /var/www/html
mysql:
image: mysql:5
image: mariadb
environment:
MYSQL_DATABASE: drupal
MYSQL_ROOT_PASSWORD: drupal
......
---
version: '3'
services:
drupal:
build:
context: .
dockerfile: Dockerfile-drupal8
......@@ -17,7 +17,7 @@ services:
working_dir: /var/www/html
mysql:
image: mysql:5
image: mariadb
environment:
MYSQL_DATABASE: drupal
MYSQL_ROOT_PASSWORD: drupal
......
......@@ -4,8 +4,7 @@ type: module
description: >-
Allow entities to inherit certain fields from other entities. Fields' values
are updated every time an entity is saved.
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9
php: '7.x'
dependencies:
- drupal:entity_reference
#!/bin/bash
#
# Check for deprecated code.
#
set -e
docker run --rm -v "$(pwd)":/var/www/html/modules/entity_inherit dcycle/drupal-check:1 entity_inherit/src
......@@ -10,9 +10,6 @@ echo '=> Run fast tests.'
echo '=> Deploy a Drupal 9 environment.'
./scripts/deploy.sh
echo '=> Drupal PHPUnit tests on required Drupal 9 environment.'
./scripts/php-unit-drupal.sh
echo '=> End-to-end tests on D9.'
./scripts/end-to-end-tests.sh
......@@ -21,18 +18,3 @@ echo '=> Tests on Drupal 9 environment.'
echo '=> Destroy the Drupal 9 environment.'
./scripts/destroy.sh
echo '=> Deploy a Drupal 8 environment.'
./scripts/deploy.sh 8
echo '=> Drupal PHPUnit tests on required Drupal 9 environment.'
./scripts/php-unit-drupal.sh
echo '=> End-to-end tests on D8.'
./scripts/end-to-end-tests.sh
echo '=> Tests on Drupal 8 environment.'
./scripts/test-running-environment.sh
echo '=> Destroy the Drupal 8 environment.'
./scripts/destroy.sh
......@@ -17,13 +17,13 @@ echo '-----'
echo 'About to start persistent (-d) containers based on the images defined'
echo 'in ./Dockerfile-* files. We are also telling docker-compose to'
echo 'rebuild the images if they are out of date.'
if [ "$1" == 8 ]; then
DRUPALVERSION=8
else
if [ -z "$1" ]; then
DRUPALVERSION=9
else
DRUPALVERSION="$1"
fi
docker-compose -f docker-compose.base.yml -f docker-compose.drupal"$DRUPALVERSION".yml up -d --build
docker-compose -f docker-compose.base.yml -f "docker-compose.drupal$DRUPALVERSION.yml" up -d --build
echo ''
echo '-----'
......
......@@ -4,10 +4,10 @@ source ~/.docker-host-ssh-credentials
# Create a droplet
DROPLET_NAME=entity-inherit
IP1=$(ssh "$DOCKERHOSTUSER"@"$DOCKERHOST" \
"./digitalocean/scripts/new-droplet.sh $DROPLET_NAME")
IP1=$(ssh "$DOCKERHOSTUSER@$DOCKERHOST" \
"./digitalocean/scripts/new-droplet.sh "$DROPLET_NAME)
# https://github.com/dcycle/docker-digitalocean-php#public-vs-private-ip-addresses
IP2=$(ssh "$DOCKERHOSTUSER"@"$DOCKERHOST" "./digitalocean/scripts/list-droplets.sh" |grep "$IP1" --after-context=10|tail -1|cut -b 44-)
IP2=$(ssh "$DOCKERHOSTUSER@$DOCKERHOST" "./digitalocean/scripts/list-droplets.sh" |grep "$IP1" --after-context=10|tail -1|cut -b 44-)
echo "Now determining which of the IPs $IP1 or $IP2 is the public IP"
if [[ $IP1 == 10.* ]]; then
IP="$IP2";
......
# See https://github.com/dcycle/docker-phpstan-drupal/blob/master/README.md#custom-config-file
parameters:
excludes_analyse:
excludePaths:
- */tests/*
- */phpunit-autoload.php
- */phpunit-bootstrap.php
......
......@@ -13,5 +13,6 @@ echo ''
docker run --rm \
-v "$PWD":/var/www/html/modules/custom/entity_inherit \
-v "$PWD"/scripts/lib/phpstan-drupal:/phpstan-drupal \
dcycle/phpstan-drupal:2 /var/www/html/modules/custom \
-c /phpstan-drupal/phpstan.neon
dcycle/phpstan-drupal:4 /var/www/html/modules/custom \
-c /phpstan-drupal/phpstan.neon \
--memory-limit=-1
#!/bin/bash
#
# Run unit tests a la Drupal. Requires the container to be running.
#
set -e
docker-compose exec -T drupal /bin/bash -c 'drush en -y simpletest && php core/scripts/run-tests.sh entity_inherit'
......@@ -4,5 +4,5 @@
#
set -e
docker run -v "$(pwd)":/app dcycle/phpunit:1 \
docker run --rm -v "$(pwd)":/app dcycle/phpunit:1 \
--group entity_inherit
......@@ -9,4 +9,4 @@ echo 'To ignore false negatives, use:'
echo '# shellcheck disable=SC2016'
# See https://github.com/dcycle/docker-shell-lint
find . -name "*.sh" -print0 | \
xargs -0 docker run -v "$(pwd)":/code dcycle/shell-lint
xargs -0 docker run --rm -v "$(pwd)":/code dcycle/shell-lint
......@@ -12,8 +12,5 @@ echo '=> Linting code.'
echo '=> Unit tests.'
./scripts/php-unit.sh
echo '=> Check for deprecated code'
./scripts/check-deprecated.sh
echo '=> Static analysis'
./scripts/php-static-analysis.sh
......@@ -21,7 +21,7 @@ trait FriendTrait {
protected function friendAccess(array $friends) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
$class = isset($trace[2]['class']) ? $trace[2]['class'] : 'not a class';
if (!(isset($class) && in_array($class, $friends))) {
if (!in_array($class, $friends)) {
throw new \Exception('Only the following classes, not ' . $class . ', have access to this function.');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment