Skip to content

Commit

Permalink
Merge pull request #171 from openeuropa/EWPP-2984
Browse files Browse the repository at this point in the history
EWPP-2984: Drupal 10 compatibility.
  • Loading branch information
brummbar authored Feb 21, 2023
2 parents bb987c1 + 3a5d28b commit 1e19b06
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 71 deletions.
38 changes: 11 additions & 27 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,27 @@ pipeline:
- /cache/${DRONE_REPO_NAME}:/cache
commands:
- composer self-update --2
- composer install --ansi --no-suggest --no-progress
when:
matrix:
COMPOSER_BOUNDARY: highest

composer-update-lowest:
group: prepare-lowest
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
volumes:
- /cache/${DRONE_REPO_NAME}:/cache
commands:
# @todo remove "composer install" step once the following issue is fixed.
# @link https://webgate.ec.europa.eu/CITnet/jira/browse/OPENEUROPA-1234
- composer self-update --2
- composer update --prefer-lowest --prefer-stable --ansi --no-progress
when:
matrix:
COMPOSER_BOUNDARY: lowest
- composer require drupal/core:~${CORE_VERSION} drupal/core-composer-scaffold:~${CORE_VERSION} --update-with-all-dependencies --ansi --no-progress --no-interaction

site-install:
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- while ! mysqladmin ping -h mysql --silent; do sleep 1; done
- ./vendor/bin/run drupal:site-install

test-grumphp:
grumphp:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- ./vendor/bin/grumphp run

test-phpunit:
phpunit:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- ./vendor/bin/phpunit

test-behat:
behat:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
Expand All @@ -93,9 +76,10 @@ pipeline:
status: failure

matrix:
COMPOSER_BOUNDARY:
- lowest
- highest
PHP_VERSION:
- 8.0
- 8.1
include:
- CORE_VERSION: 9.4.0
PHP_VERSION: 8.0
- CORE_VERSION: 9.4.0
PHP_VERSION: 8.1
- CORE_VERSION: 10.0
PHP_VERSION: 8.1
32 changes: 6 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,20 @@
"require": {
"php": ">=8.0",
"drupal/cas": "^2.1",
"drupal/core": "^9.4"
"drupal/core": "^9.4 || ^10"
},
"require-dev": {
"composer/installers": "^1.11",
"doctrine/lexer": "^1.2.3",
"drupal/cas_mock_server": "^2",
"drupal/config_devel": "^1.2",
"drupal/core-composer-scaffold": "^9.4",
"drupal/core-utility": "^9.4",
"drupal/drupal-extension": "dev-master",
"drupal/cas_mock_server": "^2.0.1",
"drupal/core-composer-scaffold": "^9.4 || ^10",
"drupal/drupal-extension": "^5.0",
"drush/drush": "^11.1",
"guzzlehttp/guzzle": "^7.0",
"masterminds/html5": "^2.7.6",
"mikey179/vfsstream": "^1.6.10",
"nikic/php-parser": "^4.12.0",
"openeuropa/behat-transformation-context": "^0.2",
"openeuropa/code-review": "^2.0.0-alpha6",
"openeuropa/task-runner-drupal-project-symlink": "^1.0-beta6",
"phpspec/prophecy-phpunit": "^2",
"symfony/console": "^4.4.30",
"symfony/css-selector": "^4.4.24",
"symfony/dom-crawler": "^4.4.44",
"symfony/finder": "^4.4.30",
"symfony/http-foundation": "^4.4.30",
"symfony/phpunit-bridge": "^6.0",
"symfony/process": "^4.4.30",
"symfony/routing": "^4.4.30",
"symfony/validator": "^4.4.35",
"symfony/yaml": "^4.4.29"
"symfony/phpunit-bridge": "^6.2"
},
"scripts": {
"post-install-cmd": "./vendor/bin/run drupal:site-setup",
Expand Down Expand Up @@ -69,13 +54,8 @@
"build/themes/contrib/{$name}": ["type:drupal-theme"]
},
"_readme": [
"Use master branch of drupal/drupal-extension to replace fabpot/goutte with behat/mink-browserkit-driver.",
"Explicit minimum version requirement of symfony/phpunit-bridge to replace drupal/core-dev testing classes and traits.",
"Explicit minimum version requirement of mikey179/vfsstream due to lower versions missing return type on vfsStreamDirectory::getIterator() method.",
"Explicit minimum version requirement of guzzlehttp/guzzle due to lower versions missing return type on CookieJar::getIterator() and CookieJar::count() methods.",
"Explicit minimum version requirement of symfony packages due to lower versions missing return type on various methods being incompatible with PHP 8.1 parent methods.",
"Explicit minimum version requirement of masterminds/html5 due to lower versions passing NULL parameters instead of string when calling DOMImplementation::createDocument() method.",
"Explicit minimum version requirement of doctrine/lexer due to lower versions throwing an annotation exception for CasProtectedUserFieldConstraint."
"Explicit requirement of mikey179/vfsstream to remove when drupal/core-dev is reinstated."
],
"drupal-scaffold": {
"locations": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: OE Authentication EU Login mock
description: EU Login mock server implementation.
package: OpenEuropa
type: module
core_version_requirement: ^9.4
core_version_requirement: ^9.4 || ^10
dependencies:
- cas:cas
- cas_mock_server:cas_mock_server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class MockResponseTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();

$this->installSchema('system', ['key_value_expire']);
$this->installConfig(['cas', 'cas_mock_server', 'oe_authentication']);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: OE Authentication User Fields
description: Provides some user basic fields and map them with EU Login attributes.
package: OpenEuropa
type: module
core_version_requirement: ^9.4
core_version_requirement: ^9.4 || ^10
dependencies:
- oe_authentication:oe_authentication
2 changes: 1 addition & 1 deletion oe_authentication.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: OE Authentication
description: Authentication against the OpenEuropa Authentication service.
package: OpenEuropa
type: module
core_version_requirement: ^9.4
core_version_requirement: ^9.4 || ^10
dependencies:
- cas:cas
1 change: 0 additions & 1 deletion runner.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ drupal:
post_install:
# Prepare the instance.
- "./vendor/bin/drush en toolbar -y"
- "./vendor/bin/drush en config_devel -y"
# Enable the modules.
- "./vendor/bin/drush en oe_authentication_user_fields oe_authentication_eulogin_mock -y"
- "./vendor/bin/drush pmu big_pipe -y"
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/ProxyCallbackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function callback() {

// Check the method of the request.
if ($current_request->getRealMethod() !== 'POST') {
return new Response(t('The Request should use the POST method'), 400);
return new Response('The Request should use the POST method', 400);
}

$pgt_id = $current_request->request->get('pgtId');
Expand All @@ -78,11 +78,11 @@ public function callback() {
// Check for both a pgtIou and pgtId parameter.
// If either is not present, inform EULogin Server of an error.
if (!isset($pgt_id) && !isset($pgt_iou)) {
return new Response(t('Missing necessary parameters'), 400);
return new Response('Missing necessary parameters', 400);
}

if ($this->checkPgtMapping($pgt_iou, $pgt_id)) {
return new Response(t('Parameters already in use'), 400);
return new Response('Parameters already in use', 400);
}

// Store the pgtIou and pgtId in the database for later use.
Expand Down
2 changes: 1 addition & 1 deletion tests/Behat/CleanupContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function getEntityTypesToCleanup(ScenarioInterface $scenario): array {
* An array of entity IDs.
*/
protected function getAllEntityIdsOfType(string $entity_type): array {
return \Drupal::entityTypeManager()->getStorage($entity_type)->getQuery()->execute();
return \Drupal::entityTypeManager()->getStorage($entity_type)->getQuery()->accessCheck(FALSE)->execute();
}

}
1 change: 0 additions & 1 deletion tests/Kernel/EuLoginEventSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class EuLoginEventSubscriberTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['key_value_expire']);
$this->installConfig(['cas', 'cas_mock_server', 'oe_authentication']);
}

Expand Down
6 changes: 2 additions & 4 deletions tests/Kernel/LoginBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
class LoginBlockTest extends KernelTestBase {

/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = [
protected static $modules = [
'block',
'oe_authentication',
'system',
Expand Down
6 changes: 2 additions & 4 deletions tests/Kernel/ProxyCallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
class ProxyCallbackTest extends KernelTestBase {

/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = [
protected static $modules = [
'oe_authentication',
'system',
'user',
Expand Down

0 comments on commit 1e19b06

Please sign in to comment.