Skip to content
Snippets Groups Projects

Issue #3233587: Create a build test that tests calling API as cleanly as possible

Merged Issue #3233587: Create a build test that tests calling API as cleanly as possible
All threads resolved!
All threads resolved!
6 files
+ 118
5
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 57
0
 
<?php
 
 
namespace Drupal\automatic_updates\ComposerStager;
 
 
use Drupal\update\UpdateManagerInterface;
 
use PhpTuf\ComposerStager\Domain\CommitterInterface;
 
use PhpTuf\ComposerStager\Domain\Output\ProcessOutputCallbackInterface;
 
 
/**
 
* Defines a committer service that clears stored update data.
 
*/
 
class Committer implements CommitterInterface {
 
 
/**
 
* The decorated committer service.
 
*
 
* @var \PhpTuf\ComposerStager\Domain\CommitterInterface
 
*/
 
protected $decorated;
 
 
/**
 
* The update manager service.
 
*
 
* @var \Drupal\update\UpdateManagerInterface
 
*/
 
protected $updateManager;
 
 
/**
 
* Constructs a Committer object.
 
*
 
* @param \PhpTuf\ComposerStager\Domain\CommitterInterface $decorated
 
* The decorated committer service.
 
* @param \Drupal\update\UpdateManagerInterface $update_manager
 
* The update manager service.
 
*/
 
public function __construct(CommitterInterface $decorated, UpdateManagerInterface $update_manager) {
 
$this->decorated = $decorated;
 
$this->updateManager = $update_manager;
 
}
 
 
/**
 
* {@inheritdoc}
 
*/
 
public function commit(string $stagingDir, string $activeDir, ?array $exclusions = [], ?ProcessOutputCallbackInterface $callback = NULL, ?int $timeout = 120): void {
 
$this->decorated->commit($stagingDir, $activeDir, $exclusions, $callback, $timeout);
 
$this->updateManager->refreshUpdateData();
 
update_storage_clear();
 
}
 
 
/**
 
* {@inheritdoc}
 
*/
 
public function directoryExists(string $stagingDir): bool {
 
return $this->decorated->directoryExists($stagingDir);
 
}
 
 
}
Loading