Skip to content
Snippets Groups Projects

Issue #3230507: Create build tests for case where site is using core recommended Composer project

Merged Issue #3230507: Create build tests for case where site is using core recommended Composer project
Compare and Show latest version
3 files
+ 19
9
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 15
5
@@ -9,6 +9,7 @@ use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\Exception\UpdateException;
use Drupal\Component\FileSystem\FileSystem;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
@@ -75,6 +76,13 @@ class Updater {
*/
protected $eventDispatcher;
/**
* The config factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs an Updater object.
*
@@ -92,8 +100,10 @@ class Updater {
* The Composer Stager's committer service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
*/
public function __construct(StateInterface $state, TranslationInterface $translation, BeginnerInterface $beginner, StagerInterface $stager, CleanerInterface $cleaner, CommitterInterface $committer, EventDispatcherInterface $event_dispatcher) {
public function __construct(StateInterface $state, TranslationInterface $translation, BeginnerInterface $beginner, StagerInterface $stager, CleanerInterface $cleaner, CommitterInterface $committer, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory) {
$this->state = $state;
$this->beginner = $beginner;
$this->stager = $stager;
@@ -101,6 +111,7 @@ class Updater {
$this->committer = $committer;
$this->setStringTranslation($translation);
$this->eventDispatcher = $event_dispatcher;
$this->configFactory = $config_factory;
}
/**
@@ -121,10 +132,9 @@ class Updater {
* The absolute path for stage directory.
*/
public function getStageDirectory(): string {
// @todo This should be unique, in order to support parallel runs, or
// multiple sites on the same server. Find a way to make it unique, and
// persistent for the entire lifetime of the update process.
$site_id = \Drupal::config('system.site')->get('uuid');
// Append the site ID to the directory in order to support parallel test
// runs, or multiple sites hosted on the same server.
$site_id = $this->configFactory->get('system.site')->get('uuid');
return FileSystem::getOsTemporaryDirectory() . '/.automatic_updates_stage_' . $site_id;
}
Loading