Skip to content
Snippets Groups Projects
Commit e7316175 authored by Yash Rode's avatar Yash Rode Committed by Ted Bowman
Browse files

Issue #3316855 by yash.rode, tedbow: Remove...

Issue #3316855 by yash.rode, tedbow: Remove \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase::copyFixtureFolderToStageDirectoryOnApply()
parent 128827d8
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@ namespace Drupal\Tests\package_manager\Kernel;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\KernelTests\KernelTestBase;
use Drupal\package_manager\Event\PreApplyEvent;
use Drupal\package_manager\Event\StageEvent;
use Drupal\package_manager\StatusCheckTrait;
use Drupal\package_manager\Validator\DiskSpaceValidator;
......@@ -276,22 +275,6 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase {
static::copyFixtureFilesTo($active_fixture_dir, $active_dir);
}
/**
* Copies a fixture directory into the stage directory on apply.
*
* @param string $fixture_dir
* Path to fixture directory from which the files will be copied.
*/
protected function copyFixtureFolderToStageDirectoryOnApply(string $fixture_dir) {
/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */
$event_dispatcher = $this->container->get('event_dispatcher');
$listener = function (PreApplyEvent $event) use ($fixture_dir): void {
static::copyFixtureFilesTo($fixture_dir, $event->getStage()->getStageDirectory());
};
$event_dispatcher->addListener(PreApplyEvent::class, $listener, PHP_INT_MAX);
}
/**
* Sets the current (running) version of core, as known to the Update module.
*
......
......@@ -4,6 +4,7 @@ namespace Drupal\Tests\package_manager\Kernel;
use Drupal\package_manager\Event\PreApplyEvent;
use Drupal\package_manager\ValidationResult;
use Drupal\Tests\package_manager\Traits\FixtureUtilityTrait;
/**
* @coversDefaultClass \Drupal\package_manager\Validator\SupportedReleaseValidator
......@@ -12,6 +13,8 @@ use Drupal\package_manager\ValidationResult;
*/
class SupportedReleaseValidatorTest extends PackageManagerKernelTestBase {
use FixtureUtilityTrait;
/**
* {@inheritdoc}
*/
......@@ -164,11 +167,11 @@ class SupportedReleaseValidatorTest extends PackageManagerKernelTestBase {
*/
public function testException(array $release_metadata, ?string $stage_fixture_dir, bool $project_in_active, array $package, array $expected_results): void {
$this->setReleaseMetadata(['drupal' => __DIR__ . '/../../fixtures/release-history/drupal.9.8.2.xml'] + $release_metadata);
if ($stage_fixture_dir) {
$this->copyFixtureFolderToStageDirectoryOnApply($stage_fixture_dir);
}
$listener = function (PreApplyEvent $event) use ($project_in_active, $package): void {
$listener = function (PreApplyEvent $event) use ($project_in_active, $package, $stage_fixture_dir): void {
if ($stage_fixture_dir) {
$this->copyFixtureFilesTo($stage_fixture_dir, $event->getStage()->getStageDirectory());
}
$stage_dir = $event->getStage()->getStageDirectory();
// @todo add test coverage for packages that don't start with 'drupal/' in
// https://www.drupal.org/node/3321386.
......
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