Commit a279acee authored by Jürgen Haas's avatar Jürgen Haas
Browse files

Issue #3268540: Cleanup code to pass PHPCS tests

parent 7e96eac5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
services:
  eca_base.commands:
    class: Drupal\eca_base\Commands\EcaBaseCommands
    arguments: []
    arguments: ['@event_dispatcher']
    tags:
      - { name: drush.command }
+15 −1
Original line number Diff line number Diff line
@@ -5,12 +5,26 @@ namespace Drupal\eca_base\Commands;
use Drupal\eca_base\BaseEvents;
use Drupal\eca_base\Event\CustomEvent;
use Drush\Commands\DrushCommands;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
 * A Drush commandfile.
 */
class EcaBaseCommands extends DrushCommands {

  /**
   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
   */
  protected EventDispatcherInterface $eventDispatcher;

  /**
   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
   */
  public function __construct(EventDispatcherInterface $eventDispatcher) {
    parent::__construct();
    $this->eventDispatcher = $eventDispatcher;
  }

  /**
   * Trigger custom event with given event ID.
   *
@@ -24,7 +38,7 @@ class EcaBaseCommands extends DrushCommands {
   */
  public function triggerCustomEvent(string $id): void {
    $event = new CustomEvent($id, []);
    \Drupal::service('event_dispatcher')->dispatch($event, BaseEvents::CUSTOM);
    $this->eventDispatcher->dispatch($event, BaseEvents::CUSTOM);
  }

}
+0 −2
Original line number Diff line number Diff line
@@ -57,8 +57,6 @@ class ConfigWriteTest extends KernelTestBase {
  public function testConfigWrite() {
    /** @var \Drupal\Core\Action\ActionManager $action_manager */
    $action_manager = \Drupal::service('plugin.manager.action');
    /** @var \Drupal\eca\Token\TokenInterface $token_services */
    $token_services = \Drupal::service('eca.token_services');
    /** @var \Drupal\Core\Session\AccountSwitcherInterface $account_switcher */
    $account_switcher = \Drupal::service('account_switcher');

+0 −1
Original line number Diff line number Diff line
@@ -234,7 +234,6 @@ class ContentExecutionChainTest extends KernelTestBase {
    // The next test will execute the same configuration on a non-priviledged
    // user. That user only has update access to the published node, therefore
    // the unpublished one must not be changed by ECA.

    // Disable the ECA config first to do some value resets without executing.
    $ecaConfig->disable()->trustData()->save();
    $published_node->title->value = 'Published node';
+1 −2
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ class TokenLoadEntityRefTest extends KernelTestBase {
    $node->field_node_ref->target_id = $referenced->id();
    $node->setNewRevision(TRUE);
    $node->save();
    $second_vid = $node->getRevisionId();

    // Create an action that that loads the referenced entity.
    /** @var \Drupal\eca_content\Plugin\Action\SetFieldValue $action */
Loading