Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled Drupal 11 CI test jobs #39

Merged
merged 5 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ jobs:
DRUPAL_PROJECT_SHA: 10.x
<<: *job-test

test-php-8.2-next:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this because D11 does not support php8.2

<<: *container_config
docker:
- image: cimg/php:8.2-browsers
environment:
DRUPAL_VERSION: 11@alpha
DRUPAL_PROJECT_SHA: 11.x
<<: *job-test

test-php-8.3:
<<: *container_config
docker:
Expand Down Expand Up @@ -172,26 +163,20 @@ workflows:
filters:
tags:
only: /.*/
# Enable D11 once https://www.drupal.org/project/config_filter/issues/3428542 is resolved
# - test-php-8.2-next:
# filters:
# tags:
# only: /.*/
- test-php-8.3:
filters:
tags:
only: /.*/
# - test-php-8.3-next:
# filters:
# tags:
# only: /.*/
- test-php-8.3-next:
filters:
tags:
only: /.*/
- deploy:
requires:
- test-php-8.2
- test-php-8.2-legacy
#- test-php-8.2-next
- test-php-8.3
#- test-php-8.3-next
- test-php-8.3-next
filters:
tags:
only: /.*/
Expand Down
15 changes: 13 additions & 2 deletions composer.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@
"phpmd/phpmd": "^2.15",
"phpspec/prophecy-phpunit": "^2",
"phpstan/extension-installer": "^1.3",
"mglaman/composer-drupal-lenient": "^1",
"vincentlanglet/twig-cs-fixer": "^2.8"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"mglaman/composer-drupal-lenient": true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using this technique https://www.drupal.org/docs/develop/using-composer/using-drupals-lenient-composer-endpoint to solve config_filter module compatibility issue.

}
},
"extra": {
"drupal-lenient": {
"allowed-list": [
"drupal/config_filter"
]
},
"phpcodesniffer-search-depth": 10,
"patches": {}
"patches": {
"drupal/config_filter": {
"Automated Drupal 11 compatibility fixes for config_filter": "https://git.drupalcode.org/project/config_filter/-/merge_requests/9.patch"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Generated Content Example 1
type: module
description: Example 1 to programmatically generate content.
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
package: Other
dependencies:
- generated_content:generated_content
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Generated Content Example 2
type: module
description: Example 2 to programmatically generate content.
core_version_requirement: ^9 || ^10
core_version_requirement: ^9 || ^10 || ^11
package: Other
dependencies:
- generated_content:generated_content
Expand Down
60 changes: 0 additions & 60 deletions tests/src/Traits/GeneratedContentTestMockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Drupal\Tests\generated_content\Traits;

use PHPUnit\Framework\MockObject\Stub\Stub;

/**
* Trait GeneratedContentTestHelperTrait.
*
Expand Down Expand Up @@ -80,64 +78,6 @@ protected static function getProtectedValue(object $object, string $property) {
return $property->getValue($class);
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexSkrypnyk
I have removed this prepare class mock because we are not using and
sebastianbergmann/phpunit#5241

* Helper to prepare class mock.
*
* @param class-string|object $class
* Class name to generate the mock.
* @param array<string, mixed|\PHPUnit\Framework\MockObject\Stub\Stub> $methodsMap
* Optional array of methods and values, keyed by method name.
* @param array<mixed> $args
* Optional array of constructor arguments. If omitted, a constructor will
* not be called.
*
* @return \PHPUnit\Framework\MockObject\MockObject|string
* Mocked class.
*
* @throws \ReflectionException
*/
protected function prepareMock($class, array $methodsMap = [], array $args = []) {
$methods = array_keys($methodsMap);

$reflectionClass = new \ReflectionClass($class);

$class_name = is_object($class) ? get_class($class) : $class;

if ($reflectionClass->isAbstract()) {
$mock = $this->getMockForAbstractClass(
$class_name, $args, '', !empty($args), TRUE, TRUE, $methods
);
}
else {
$mock = $this->getMockBuilder($class_name);
if (!empty($args)) {
$mock = $mock->enableOriginalConstructor()
->setConstructorArgs($args);
}
else {
$mock = $mock->disableOriginalConstructor();
}
$mock = $mock->onlyMethods($methods)
->getMock();
}

foreach ($methodsMap as $method => $value) {
// Handle callback values differently.
if ($value instanceof Stub && strpos(get_class($value), 'Callback') !== FALSE) {
$mock->expects($this->any())
->method($method)
->will($value);
}
else {
$mock->expects($this->any())
->method($method)
->willReturn($value);
}
}

return $mock;
}

/**
* Check if testing framework was ran with --debug option.
*/
Expand Down