Skip to content
Snippets Groups Projects
Commit d8153ff3 authored by GitLab CI's avatar GitLab CI
Browse files

Merge branch 'develop' into 'main'

Merging develop into main

See merge request !20
parents 626e1798 fb8b8a2b
No related branches found
No related tags found
1 merge request!20Merging develop into main
Pipeline #1253652 passed
ahoyapi ahoyapi
checkstyle checkstyle
cspellmodule
eslintmodule eslintmodule
lakedrops lakedrops
mariadbtest mariadbtest
...@@ -15,9 +16,9 @@ phpmetricsmodule ...@@ -15,9 +16,9 @@ phpmetricsmodule
phpstanmodule phpstanmodule
phpunitgroup phpunitgroup
phpunitmodule phpunitmodule
preparecorefordev
projectname projectname
stylelintmodule stylelintmodule
stylelintprepare
stylelintrc stylelintrc
traefik traefik
usessl usessl
...@@ -79,10 +79,10 @@ commands: ...@@ -79,10 +79,10 @@ commands:
if [[ -f tests/junit/${module}.xml ]]; then JUNIT=--junit=tests/junit/${module}.xml; fi if [[ -f tests/junit/${module}.xml ]]; then JUNIT=--junit=tests/junit/${module}.xml; fi
ahoy d4d exec vendor/bin/phpmetrics --report-html=tests/metrics/$module $JUNIT web/modules/contrib/$module $@ ahoy d4d exec vendor/bin/phpmetrics --report-html=tests/metrics/$module $JUNIT web/modules/contrib/$module $@
usage: PHP Metrics by module usage: PHP Metrics by module
stylelintprepare: preparecorefordev:
cmd: | cmd: |
/usr/local/bin/node_cmd yarn --cwd web/core add stylelint-junit-formatter $@ /usr/local/bin/node_cmd yarn --cwd web/core add stylelint-junit-formatter $@
usage: Prepare environment for style linter usage: Prepare environment for other tests like style linter and cspell
stylelintmodule: stylelintmodule:
cmd: | cmd: |
module=$1 module=$1
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
"drupal/schema_diff": "*", "drupal/schema_diff": "*",
"drupal/webprofiler": "*", "drupal/webprofiler": "*",
"lakedrops/ahoy": "*", "lakedrops/ahoy": "*",
"lakedrops/behat4drupal": "*",
"lakedrops/composer-json-utils": "*", "lakedrops/composer-json-utils": "*",
"lakedrops/docker4drupal": "*", "lakedrops/docker4drupal": "*",
"lakedrops/dorgflow": "*", "lakedrops/dorgflow": "*",
...@@ -72,7 +71,8 @@ ...@@ -72,7 +71,8 @@
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {
"lakedrops/*": false "lakedrops/*": false,
"zodiacmedia/drupal-libraries-installer": false
} }
}, },
"autoload": { "autoload": {
......
<?php
namespace LakeDrops\DrupalDevelopmentEnvironment\TestSuite;
require_once 'web/core/tests/TestSuites/TestSuiteBase.php';
use Drupal\Core\Test\TestDiscovery;
use Drupal\Tests\TestSuites\TestSuiteBase;
/**
* Base class for Drupal test suites.
*/
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.
*
* An extension is defined as a directory with an *.info.yml file in it.
*
* @param string $root
* Path to the root of the Drupal installation.
*
* @return string[]
* Associative array of extension paths, with extension name as keys.
*/
protected function findExtensionDirectories($root): array {
$paths = [
$root . '/modules/custom',
$root . '/profiles/custom',
$root . '/themes/custom',
];
$extension_roots = array_filter($paths, 'file_exists');
$extension_directories = array_map('drupal_phpunit_find_extension_directories', $extension_roots);
return array_reduce($extension_directories, 'array_merge', []);
}
/**
* Find and add tests to the suite for core and any extensions.
*
* @param string $root
* Path to the root of the Drupal installation.
* @param string $suite_namespace
* SubNamespace used to separate test suite. Examples: Unit, Functional.
*/
protected function addTestsBySuiteNamespace($root, $suite_namespace): void {
foreach ($this->findExtensionDirectories($root) as $extension_name => $dir) {
$test_path = "$dir/tests/src/$suite_namespace";
if (is_dir($test_path)) {
$this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\Tests\\$extension_name\\$suite_namespace\\", $test_path));
}
}
}
}
<?php
namespace LakeDrops\DrupalDevelopmentEnvironment\TestSuite;
require_once __DIR__ . '/Base.php';
/**
* Discovers tests for the functional test suite.
*/
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(): static {
$root = dirname(__DIR__, 5) . '/web';
$suite = new static('functional');
$suite->addTestsBySuiteNamespace($root, 'Functional');
return $suite;
}
}
<?php
namespace LakeDrops\DrupalDevelopmentEnvironment\TestSuite;
require_once __DIR__ . '/Base.php';
/**
* Discovers tests for the functional test suite.
*/
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(): static {
$root = dirname(__DIR__, 5) . '/web';
$suite = new static('functional-javascript');
$suite->addTestsBySuiteNamespace($root, 'FunctionalJavascript');
return $suite;
}
}
<?php
namespace LakeDrops\DrupalDevelopmentEnvironment\TestSuite;
require_once __DIR__ . '/Base.php';
/**
* Discovers tests for the unit test suite.
*/
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(): static {
$root = dirname(__DIR__, 5) . '/web';
$suite = new static('kernel');
$suite->addTestsBySuiteNamespace($root, 'Kernel');
return $suite;
}
}
<?php
namespace LakeDrops\DrupalDevelopmentEnvironment\TestSuite;
require_once __DIR__ . '/Base.php';
/**
* Discovers tests for the unit test suite.
*/
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(): static {
$root = dirname(__DIR__, 5) . '/web';
$suite = new static('unit');
$suite->addTestsBySuiteNamespace($root, 'Unit');
return $suite;
}
}
...@@ -35,16 +35,19 @@ ...@@ -35,16 +35,19 @@
</php> </php>
<testsuites> <testsuites>
<testsuite name="unit"> <testsuite name="unit">
<file>../vendor/lakedrops/drupal-development-environment/src/TestSuite/Unit.php</file> <file>./tests/TestSuites/UnitTestSuite.php</file>
</testsuite> </testsuite>
<testsuite name="kernel"> <testsuite name="kernel">
<file>../vendor/lakedrops/drupal-development-environment/src/TestSuite/Kernel.php</file> <file>./tests/TestSuites/KernelTestSuite.php</file>
</testsuite> </testsuite>
<testsuite name="functional"> <testsuite name="functional">
<file>../vendor/lakedrops/drupal-development-environment/src/TestSuite/Functional.php</file> <file>./tests/TestSuites/FunctionalTestSuite.php</file>
</testsuite> </testsuite>
<testsuite name="functional-javascript"> <testsuite name="functional-javascript">
<file>../vendor/lakedrops/drupal-development-environment/src/TestSuite/FunctionalJavascript.php</file> <file>./tests/TestSuites/FunctionalJavascriptTestSuite.php</file>
</testsuite>
<testsuite name="build">
<file>./tests/TestSuites/BuildTestSuite.php</file>
</testsuite> </testsuite>
</testsuites> </testsuites>
<listeners> <listeners>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment