Skip to content
Snippets Groups Projects
Commit 6bf0d736 authored by Ted Bowman's avatar Ted Bowman Committed by Adam G-H
Browse files

Issue #3232003 by tedbow: Standardize class names for event subscribers used for validation

parent dfbf0dbd
No related branches found
No related tags found
1 merge request!31Issue #3232003: Standardize class names for event subscribers used for validation
...@@ -5,11 +5,6 @@ services: ...@@ -5,11 +5,6 @@ services:
automatic_updates.updater: automatic_updates.updater:
class: Drupal\automatic_updates\Updater class: Drupal\automatic_updates\Updater
arguments: ['@state', '@string_translation','@automatic_updates.beginner', '@automatic_updates.stager', '@automatic_updates.cleaner', '@automatic_updates.committer', '@event_dispatcher', '@config.factory'] arguments: ['@state', '@string_translation','@automatic_updates.beginner', '@automatic_updates.stager', '@automatic_updates.cleaner', '@automatic_updates.committer', '@event_dispatcher', '@config.factory']
automatic_updates.staged_package_validator:
class: Drupal\automatic_updates\Validation\StagedProjectsValidation
arguments: ['@string_translation', '@automatic_updates.updater' ]
tags:
- { name: event_subscriber }
automatic_updates.beginner: automatic_updates.beginner:
class: PhpTuf\ComposerStager\Domain\Beginner class: PhpTuf\ComposerStager\Domain\Beginner
arguments: arguments:
...@@ -76,13 +71,18 @@ services: ...@@ -76,13 +71,18 @@ services:
arguments: ['%app.root%', '%site.path%', '@file_system', '@stream_wrapper_manager'] arguments: ['%app.root%', '%site.path%', '@file_system', '@stream_wrapper_manager']
tags: tags:
- { name: event_subscriber } - { name: event_subscriber }
automatic_updates.update_version_subscriber: automatic_updates.staged_projects_validator:
class: Drupal\automatic_updates\Event\UpdateVersionSubscriber class: Drupal\automatic_updates\Validator\StagedProjectsValidator
arguments: [ '@string_translation', '@automatic_updates.updater' ]
tags:
- { name: event_subscriber }
automatic_updates.update_version_validator:
class: Drupal\automatic_updates\Validator\UpdateVersionValidator
arguments: ['@automatic_updates.updater'] arguments: ['@automatic_updates.updater']
tags: tags:
- { name: event_subscriber } - { name: event_subscriber }
automatic_updates.composer_executable_validator: automatic_updates.composer_executable_validator:
class: Drupal\automatic_updates\Validation\ComposerExecutableValidator class: Drupal\automatic_updates\Validator\ComposerExecutableValidator
arguments: ['@automatic_updates.exec_finder'] arguments: ['@automatic_updates.exec_finder']
tags: tags:
- { name: event_subscriber } - { name: event_subscriber }
<?php <?php
namespace Drupal\automatic_updates\Validation; namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\AutomaticUpdatesEvents; use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\UpdateEvent; use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\Validation\ValidationResult;
use PhpTuf\ComposerStager\Exception\IOException; use PhpTuf\ComposerStager\Exception\IOException;
use PhpTuf\ComposerStager\Infrastructure\Process\ExecutableFinderInterface; use PhpTuf\ComposerStager\Infrastructure\Process\ExecutableFinderInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
......
<?php <?php
namespace Drupal\automatic_updates\Validation; namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\AutomaticUpdatesEvents; use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\UpdateEvent; use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\Exception\UpdateException; use Drupal\automatic_updates\Exception\UpdateException;
use Drupal\automatic_updates\Updater; use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Component\Serialization\Json; use Drupal\Component\Serialization\Json;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\StringTranslation\TranslationInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/** /**
* An event subscriber that validates staged Drupal projects. * Validates the staged Drupal projects.
*/ */
final class StagedProjectsValidation implements EventSubscriberInterface { final class StagedProjectsValidator implements EventSubscriberInterface {
use StringTranslationTrait; use StringTranslationTrait;
......
<?php <?php
namespace Drupal\automatic_updates\Event; namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\AutomaticUpdatesEvents; use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\PreStartEvent;
use Drupal\automatic_updates\Updater; use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\Validation\ValidationResult; use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Core\Extension\ExtensionVersion; use Drupal\Core\Extension\ExtensionVersion;
...@@ -12,7 +13,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; ...@@ -12,7 +13,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/** /**
* Validates that core updates are within a supported version range. * Validates that core updates are within a supported version range.
*/ */
class UpdateVersionSubscriber implements EventSubscriberInterface { class UpdateVersionValidator implements EventSubscriberInterface {
use StringTranslationTrait; use StringTranslationTrait;
......
...@@ -9,7 +9,7 @@ use PhpTuf\ComposerStager\Exception\IOException; ...@@ -9,7 +9,7 @@ use PhpTuf\ComposerStager\Exception\IOException;
use PhpTuf\ComposerStager\Infrastructure\Process\ExecutableFinderInterface; use PhpTuf\ComposerStager\Infrastructure\Process\ExecutableFinderInterface;
/** /**
* @covers \Drupal\automatic_updates\Validation\ComposerExecutableValidator * @covers \Drupal\automatic_updates\Validator\ComposerExecutableValidator
* *
* @group automatic_updates * @group automatic_updates
*/ */
......
...@@ -4,7 +4,7 @@ namespace Drupal\Tests\automatic_updates\Unit; ...@@ -4,7 +4,7 @@ namespace Drupal\Tests\automatic_updates\Unit;
use Drupal\automatic_updates\Event\UpdateEvent; use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\Updater; use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\Validation\StagedProjectsValidation; use Drupal\automatic_updates\Validator\StagedProjectsValidator;
use Drupal\Component\FileSystem\FileSystem; use Drupal\Component\FileSystem\FileSystem;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup; use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup;
...@@ -12,11 +12,11 @@ use Drupal\Core\StringTranslation\TranslationInterface; ...@@ -12,11 +12,11 @@ use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
/** /**
* @coversDefaultClass \Drupal\automatic_updates\Validation\StagedProjectsValidation * @coversDefaultClass \Drupal\automatic_updates\Validator\StagedProjectsValidator
* *
* @group automatic_updates * @group automatic_updates
*/ */
class StagedProjectsValidationTest extends UnitTestCase { class StagedProjectsValidatorTest extends UnitTestCase {
/** /**
* Tests that if an exception is thrown, the update event will absorb it. * Tests that if an exception is thrown, the update event will absorb it.
...@@ -29,7 +29,7 @@ class StagedProjectsValidationTest extends UnitTestCase { ...@@ -29,7 +29,7 @@ class StagedProjectsValidationTest extends UnitTestCase {
$updater = $this->prophesize(Updater::class); $updater = $this->prophesize(Updater::class);
$updater->getActiveDirectory()->willReturn($active_dir); $updater->getActiveDirectory()->willReturn($active_dir);
$updater->getStageDirectory()->willReturn($stage_dir); $updater->getStageDirectory()->willReturn($stage_dir);
$validator = new StagedProjectsValidation(new TestTranslationManager(), $updater->reveal()); $validator = new StagedProjectsValidator(new TestTranslationManager(), $updater->reveal());
$event = new UpdateEvent(); $event = new UpdateEvent();
$validator->validateStagedProjects($event); $validator->validateStagedProjects($event);
...@@ -62,7 +62,7 @@ class StagedProjectsValidationTest extends UnitTestCase { ...@@ -62,7 +62,7 @@ class StagedProjectsValidationTest extends UnitTestCase {
$updater->getActiveDirectory()->willReturn("$fixtures_dir/active"); $updater->getActiveDirectory()->willReturn("$fixtures_dir/active");
$updater->getStageDirectory()->willReturn("$fixtures_dir/staged"); $updater->getStageDirectory()->willReturn("$fixtures_dir/staged");
$validator = new StagedProjectsValidation(new TestTranslationManager(), $updater->reveal()); $validator = new StagedProjectsValidator(new TestTranslationManager(), $updater->reveal());
$event = new UpdateEvent(); $event = new UpdateEvent();
$validator->validateStagedProjects($event); $validator->validateStagedProjects($event);
$results = $event->getResults(); $results = $event->getResults();
...@@ -124,7 +124,7 @@ class StagedProjectsValidationTest extends UnitTestCase { ...@@ -124,7 +124,7 @@ class StagedProjectsValidationTest extends UnitTestCase {
$updater = $this->prophesize(Updater::class); $updater = $this->prophesize(Updater::class);
$updater->getActiveDirectory()->willReturn("$fixtures_dir/active"); $updater->getActiveDirectory()->willReturn("$fixtures_dir/active");
$updater->getStageDirectory()->willReturn("$fixtures_dir/staged"); $updater->getStageDirectory()->willReturn("$fixtures_dir/staged");
$validator = new StagedProjectsValidation(new TestTranslationManager(), $updater->reveal()); $validator = new StagedProjectsValidator(new TestTranslationManager(), $updater->reveal());
$event = new UpdateEvent(); $event = new UpdateEvent();
$validator->validateStagedProjects($event); $validator->validateStagedProjects($event);
$results = $event->getResults(); $results = $event->getResults();
...@@ -140,7 +140,7 @@ class StagedProjectsValidationTest extends UnitTestCase { ...@@ -140,7 +140,7 @@ class StagedProjectsValidationTest extends UnitTestCase {
$updater = $this->prophesize(Updater::class); $updater = $this->prophesize(Updater::class);
$updater->getActiveDirectory()->willReturn("$fixtures_dir/active"); $updater->getActiveDirectory()->willReturn("$fixtures_dir/active");
$updater->getStageDirectory()->willReturn("$fixtures_dir"); $updater->getStageDirectory()->willReturn("$fixtures_dir");
$validator = new StagedProjectsValidation(new TestTranslationManager(), $updater->reveal()); $validator = new StagedProjectsValidator(new TestTranslationManager(), $updater->reveal());
$event = new UpdateEvent(); $event = new UpdateEvent();
$validator->validateStagedProjects($event); $validator->validateStagedProjects($event);
$results = $event->getResults(); $results = $event->getResults();
......
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