Skip to content
Snippets Groups Projects
Commit 19760c80 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3284530 by phenaproxima: Stage does not need the path factory to be injected

parent f56a9625
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,6 @@ services: ...@@ -26,7 +26,6 @@ services:
- '@event_dispatcher' - '@event_dispatcher'
- '@tempstore.shared' - '@tempstore.shared'
- '@datetime.time' - '@datetime.time'
- '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface'
automatic_updates.cron_updater: automatic_updates.cron_updater:
class: Drupal\automatic_updates\CronUpdater class: Drupal\automatic_updates\CronUpdater
arguments: arguments:
...@@ -41,7 +40,6 @@ services: ...@@ -41,7 +40,6 @@ services:
- '@event_dispatcher' - '@event_dispatcher'
- '@tempstore.shared' - '@tempstore.shared'
- '@datetime.time' - '@datetime.time'
- '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface'
automatic_updates.staged_projects_validator: automatic_updates.staged_projects_validator:
class: Drupal\automatic_updates\Validator\StagedProjectsValidator class: Drupal\automatic_updates\Validator\StagedProjectsValidator
arguments: arguments:
......
...@@ -11,7 +11,6 @@ services: ...@@ -11,7 +11,6 @@ services:
- '@event_dispatcher' - '@event_dispatcher'
- '@tempstore.shared' - '@tempstore.shared'
- '@datetime.time' - '@datetime.time'
- '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface'
automatic_updates_extensions.validator.target_release: automatic_updates_extensions.validator.target_release:
class: Drupal\automatic_updates_extensions\Validator\UpdateReleaseValidator class: Drupal\automatic_updates_extensions\Validator\UpdateReleaseValidator
tags: tags:
......
...@@ -4,7 +4,6 @@ namespace Drupal\package_manager; ...@@ -4,7 +4,6 @@ namespace Drupal\package_manager;
use Drupal\Core\Extension\ModuleUninstallValidatorInterface; use Drupal\Core\Extension\ModuleUninstallValidatorInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerAwareTrait;
...@@ -29,8 +28,7 @@ class PackageManagerUninstallValidator implements ModuleUninstallValidatorInterf ...@@ -29,8 +28,7 @@ class PackageManagerUninstallValidator implements ModuleUninstallValidatorInterf
$this->container->get('file_system'), $this->container->get('file_system'),
$this->container->get('event_dispatcher'), $this->container->get('event_dispatcher'),
$this->container->get('tempstore.shared'), $this->container->get('tempstore.shared'),
$this->container->get('datetime.time'), $this->container->get('datetime.time')
$this->container->get(PathFactoryInterface::class)
); );
if ($stage->isAvailable() || !$stage->isApplying()) { if ($stage->isAvailable() || !$stage->isApplying()) {
return []; return [];
......
...@@ -24,7 +24,7 @@ use Drupal\package_manager\Exception\StageValidationException; ...@@ -24,7 +24,7 @@ use Drupal\package_manager\Exception\StageValidationException;
use PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface; use PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface;
use PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface; use PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface;
use PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface; use PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface;
use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface; use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactory;
use PhpTuf\ComposerStager\Infrastructure\Value\PathList\PathList; use PhpTuf\ComposerStager\Infrastructure\Value\PathList\PathList;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
...@@ -187,10 +187,8 @@ class Stage { ...@@ -187,10 +187,8 @@ class Stage {
* The shared tempstore factory. * The shared tempstore factory.
* @param \Drupal\Component\Datetime\TimeInterface $time * @param \Drupal\Component\Datetime\TimeInterface $time
* The time service. * The time service.
* @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $path_factory
* The path factory service.
*/ */
public function __construct(ConfigFactoryInterface $config_factory, PathLocator $path_locator, BeginnerInterface $beginner, StagerInterface $stager, CommitterInterface $committer, FileSystemInterface $file_system, EventDispatcherInterface $event_dispatcher, SharedTempStoreFactory $shared_tempstore, TimeInterface $time, PathFactoryInterface $path_factory) { public function __construct(ConfigFactoryInterface $config_factory, PathLocator $path_locator, BeginnerInterface $beginner, StagerInterface $stager, CommitterInterface $committer, FileSystemInterface $file_system, EventDispatcherInterface $event_dispatcher, SharedTempStoreFactory $shared_tempstore, TimeInterface $time) {
$this->configFactory = $config_factory; $this->configFactory = $config_factory;
$this->pathLocator = $path_locator; $this->pathLocator = $path_locator;
$this->beginner = $beginner; $this->beginner = $beginner;
...@@ -200,7 +198,7 @@ class Stage { ...@@ -200,7 +198,7 @@ class Stage {
$this->eventDispatcher = $event_dispatcher; $this->eventDispatcher = $event_dispatcher;
$this->time = $time; $this->time = $time;
$this->tempStore = $shared_tempstore->get('package_manager_stage'); $this->tempStore = $shared_tempstore->get('package_manager_stage');
$this->pathFactory = $path_factory; $this->pathFactory = new PathFactory();
} }
/** /**
......
...@@ -5,7 +5,6 @@ namespace Drupal\package_manager_test_api; ...@@ -5,7 +5,6 @@ namespace Drupal\package_manager_test_api;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\package_manager\PathLocator; use Drupal\package_manager\PathLocator;
use Drupal\package_manager\Stage; use Drupal\package_manager\Stage;
use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
...@@ -55,8 +54,7 @@ class ApiController extends ControllerBase { ...@@ -55,8 +54,7 @@ class ApiController extends ControllerBase {
$container->get('file_system'), $container->get('file_system'),
$container->get('event_dispatcher'), $container->get('event_dispatcher'),
$container->get('tempstore.shared'), $container->get('tempstore.shared'),
$container->get('datetime.time'), $container->get('datetime.time')
$container->get(PathFactoryInterface::class)
); );
return new static( return new static(
$stage, $stage,
......
...@@ -107,8 +107,7 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase { ...@@ -107,8 +107,7 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase {
$this->container->get('file_system'), $this->container->get('file_system'),
$this->container->get('event_dispatcher'), $this->container->get('event_dispatcher'),
$this->container->get('tempstore.shared'), $this->container->get('tempstore.shared'),
$this->container->get('datetime.time'), $this->container->get('datetime.time')
new TestPathFactory()
); );
} }
...@@ -278,6 +277,7 @@ trait TestStageTrait { ...@@ -278,6 +277,7 @@ trait TestStageTrait {
parent::__construct(...$arguments); parent::__construct(...$arguments);
$mirror = new \ReflectionClass(Stage::class); $mirror = new \ReflectionClass(Stage::class);
$this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), PackageManagerKernelTestBase::$testStagingRoot); $this->tempStore->set($mirror->getConstant('TEMPSTORE_STAGING_ROOT_KEY'), PackageManagerKernelTestBase::$testStagingRoot);
$this->pathFactory = new TestPathFactory();
} }
/** /**
......
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