Skip to content

Commit

Permalink
Merge pull request #174 from openeuropa/EWPP-3512
Browse files Browse the repository at this point in the history
EWPP-3512: drush.services.yml is mandatory with Drush 12.
  • Loading branch information
22Alexandra authored Aug 2, 2023
2 parents 19f85ce + 810cf57 commit f72ee35
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"drupal/cas_mock_server": "^2.0.1",
"drupal/core-composer-scaffold": "^9.4 || ^10",
"drupal/drupal-extension": "^5.0",
"drush/drush": "^11.1",
"drush/drush": "^11.1 || ^12",
"mikey179/vfsstream": "^1.6.10",
"openeuropa/behat-transformation-context": "^0.2",
"openeuropa/code-review": "^2.0.0-alpha6",
Expand Down Expand Up @@ -61,6 +61,11 @@
"locations": {
"web-root": "./build"
}
},
"drush": {
"services": {
"drush.services.yml": "^11"
}
}
},
"config": {
Expand Down
6 changes: 6 additions & 0 deletions modules/oe_authentication_user_fields/drush.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
oe_authentication_user_fields.sanitize_commands:
class: Drupal\oe_authentication_user_fields\Commands\sql\UserSanitizeCommand
arguments: [ '@entity_type.manager', '@database' ]
tags:
- { name: drush.command }
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@ services:
class: Drupal\oe_authentication_user_fields\EventSubscriber\EuLoginAttributesToUserFieldsSubscriber
tags:
- { name: event_subscriber }
oe_authentication_user_fields.sanitize_commands:
class: Drupal\oe_authentication_user_fields\Commands\sql\UserSanitizeCommand
arguments: ['@entity_type.manager', '@database']
tags:
- { name: drush.command }
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Drupal\oe_authentication_user_fields\Commands\sql;

use Consolidation\AnnotatedCommand\CommandData;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drush\Commands\DrushCommands;
use Drush\Drupal\Commands\sql\SanitizePluginInterface;
use Consolidation\AnnotatedCommand\CommandData;
use Symfony\Component\Console\Input\InputInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;

/**
* Sanitizes the user fields related data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ public function testEuLoginUsersDataSanitization() {
]);

$this->drush('sql:sanitize');
$expected = 'The following operations will be performed:' . PHP_EOL . PHP_EOL;
$expected .= '* Sanitise user fields.' . PHP_EOL;
$expected = 'The following operations will be performed:' . PHP_EOL;
// An extra newline is added when the command is executed with Drupal 9.x.
// @todo Remove when support for Drupal 9.x is dropped.
$expected .= version_compare(\Drupal::VERSION, '10.0.0', '<') ? PHP_EOL : '';
$expected .= '* Truncate sessions table.' . PHP_EOL;
$expected .= '* Sanitize text fields associated with users.' . PHP_EOL;
$expected .= '* Sanitize user passwords.' . PHP_EOL;
$expected .= '* Sanitize user emails.';
$expected .= '* Sanitize user emails.' . PHP_EOL;
$expected .= '* Sanitise user fields.';
$this->assertOutputEquals($expected);

$user = \Drupal::entityTypeManager()->getStorage('user')->load($user->id());
Expand Down
2 changes: 1 addition & 1 deletion src/Event/EuLoginEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Drupal\cas\Service\CasHelper;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\oe_authentication\CasProcessor;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\oe_authentication\CasProcessor;

/**
* Event subscriber for CAS module events.
Expand Down
2 changes: 1 addition & 1 deletion tests/Behat/AuthenticationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Drupal\Tests\oe_authentication\Behat;

use Drupal\user\Entity\User;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Drupal\user\Entity\User;
use Drupal\user\UserInterface;

/**
Expand Down

0 comments on commit f72ee35

Please sign in to comment.