From 5eb862e28104bc89185111f2442080e409fd48d6 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen.haas@lakedrops.com> Date: Tue, 20 Feb 2024 17:46:39 +0100 Subject: [PATCH] Update CI tests --- .gitlab-ci.yml | 4 ++-- composer.json | 22 +++++----------------- src/Plugin.php | 7 +++---- src/TestSuite/Base.php | 7 +++++++ src/TestSuite/Functional.php | 10 +++++++++- src/TestSuite/FunctionalJavascript.php | 10 +++++++++- src/TestSuite/Kernel.php | 10 +++++++++- src/TestSuite/Unit.php | 10 +++++++++- 8 files changed, 53 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d068046..1d23429 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ include: - - project: 'gitlab-ci-cd/composer-packages' + - project: 'gitlab-ci-cd/drupal' ref: main - file: '/composer-packages.yml' + file: '/private-modules.yml' diff --git a/composer.json b/composer.json index bd70bce..d9d9e48 100644 --- a/composer.json +++ b/composer.json @@ -35,12 +35,6 @@ "source": "https://gitlab.lakedrops.com/composer/plugin/drupal-development-environment/tree/main", "docs": "https://devops-tools.docs.lakedrops.com/composer/plugin/drupal-dev-environment/" }, - "repositories": [ - { - "type": "composer", - "url": "https://packages.drupal.org/8" - } - ], "require": { "php": ">=8.1", "composer-plugin-api": "^2", @@ -75,8 +69,11 @@ "composer/composer": "^2", "roave/security-advisories": "dev-latest" }, - "minimum-stability": "dev", - "prefer-stable": true, + "config": { + "allow-plugins": { + "lakedrops/*": false, + } + }, "autoload": { "psr-4": { "LakeDrops\\DrupalDevelopmentEnvironment\\": "src/" @@ -84,14 +81,5 @@ }, "extra": { "class": "LakeDrops\\DrupalDevelopmentEnvironment\\Plugin" - }, - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true, - "drupal/core-composer-scaffold": false, - "lakedrops/*": false, - "php-http/discovery": false, - "phpstan/extension-installer": true - } } } diff --git a/src/Plugin.php b/src/Plugin.php index e88a62b..6430c04 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -75,11 +75,10 @@ class Plugin extends BasePlugin { * The event that triggered the plugin. */ public function prepareProject(Event $event): void { - /** @var Handler $handler */ + /** @var \LakeDrops\DrupalDevelopmentEnvironment\Handler $handler */ $handler = $this->handler; - $handler - ->setEvent($event) - ->setupLakeDropsProject(); + $handler->setEvent($event); + $handler->setupLakeDropsProject(); } } diff --git a/src/TestSuite/Base.php b/src/TestSuite/Base.php index 4309435..a4e4176 100644 --- a/src/TestSuite/Base.php +++ b/src/TestSuite/Base.php @@ -12,6 +12,13 @@ use Drupal\Tests\TestSuites\TestSuiteBase; */ abstract class Base extends TestSuiteBase { + /** + * Unused variable to allow for otherwise useless __construct overrides. + * + * @var string + */ + protected string $internalTestType; + /** * Finds extensions in a Drupal installation. * diff --git a/src/TestSuite/Functional.php b/src/TestSuite/Functional.php index ddfd849..a717897 100644 --- a/src/TestSuite/Functional.php +++ b/src/TestSuite/Functional.php @@ -9,13 +9,21 @@ require_once __DIR__ . '/Base.php'; */ class Functional extends Base { + /** + * {@inheritdoc} + */ + final public function __construct($theClass = '', string $name = '') { + parent::__construct($theClass, $name); + $this->internalTestType = 'functional'; + } + /** * Factory method which loads up a suite with all functional tests. * * @return static * The test suite. */ - public static function suite(): Functional { + public static function suite(): static { $root = dirname(__DIR__, 5) . '/web'; $suite = new static('functional'); diff --git a/src/TestSuite/FunctionalJavascript.php b/src/TestSuite/FunctionalJavascript.php index 4f4e95f..9d7fdf8 100644 --- a/src/TestSuite/FunctionalJavascript.php +++ b/src/TestSuite/FunctionalJavascript.php @@ -9,13 +9,21 @@ require_once __DIR__ . '/Base.php'; */ class FunctionalJavascript extends Base { + /** + * {@inheritdoc} + */ + final public function __construct($theClass = '', string $name = '') { + parent::__construct($theClass, $name); + $this->internalTestType = 'functional javascript'; + } + /** * Factory method which loads up a suite with all functional tests. * * @return static * The test suite. */ - public static function suite(): FunctionalJavascript { + public static function suite(): static { $root = dirname(__DIR__, 5) . '/web'; $suite = new static('functional-javascript'); diff --git a/src/TestSuite/Kernel.php b/src/TestSuite/Kernel.php index 63ee49e..457bdfc 100644 --- a/src/TestSuite/Kernel.php +++ b/src/TestSuite/Kernel.php @@ -9,13 +9,21 @@ require_once __DIR__ . '/Base.php'; */ class Kernel extends Base { + /** + * {@inheritdoc} + */ + final public function __construct($theClass = '', string $name = '') { + parent::__construct($theClass, $name); + $this->internalTestType = 'kernel'; + } + /** * Factory method which loads up a suite with all unit tests. * * @return static * The test suite. */ - public static function suite(): Kernel { + public static function suite(): static { $root = dirname(__DIR__, 5) . '/web'; $suite = new static('kernel'); diff --git a/src/TestSuite/Unit.php b/src/TestSuite/Unit.php index bcad233..4a0d09a 100644 --- a/src/TestSuite/Unit.php +++ b/src/TestSuite/Unit.php @@ -9,13 +9,21 @@ require_once __DIR__ . '/Base.php'; */ class Unit extends Base { + /** + * {@inheritdoc} + */ + final public function __construct($theClass = '', string $name = '') { + parent::__construct($theClass, $name); + $this->internalTestType = 'unit'; + } + /** * Factory method which loads up a suite with all unit tests. * * @return static * The test suite. */ - public static function suite(): Unit { + public static function suite(): static { $root = dirname(__DIR__, 5) . '/web'; $suite = new static('unit'); -- GitLab