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

Issue #3317796 by phenaproxima: Make StagedProjectsValidatorTest fixture-less

parent 45ba6f41
No related branches found
No related tags found
No related merge requests found
{
"_readme": [
"This file simulates a list of packages installed in the active directory of a virtual project.",
"It will be compared against staged.installed.json.",
"See \\Drupal\\Tests\\automatic_updates\\Kernel\\StatusCheck\\StagedProjectsValidatorTest::testErrors()"
],
"packages": [
{
"name": "drupal/core",
"version": "9.8.0",
"type": "drupal-core",
"extra": {
"drupal-scaffold": {
"file-mapping": {}
}
}
},
{
"name": "drupal/test_module",
"version": "1.3.0",
"type": "drupal-module"
},
{
"name": "other/removed",
"description": "This project is removed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
},
{
"name": "drupal/dev-test_module",
"version": "1.3.0",
"type": "drupal-module"
},
{
"name": "other/dev-removed",
"description": "This project is removed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
}
],
"dev": true,
"dev-package-names": [
"drupal/dev-test_module",
"other/dev-removed"
]
}
<?php
/**
* @file
*/
return [
'versions' => [
'drupal/test_module' => [
'type' => 'drupal-module',
'install_path' => '../../modules/test_module',
],
'drupal/dev-test_module' => [
'type' => 'drupal-module',
'install_path' => '../../modules/dev-test_module',
],
],
];
{
"_readme": [
"This file simulates a list of packages installed in the active directory of a virtual project.",
"It will be compared against staged.installed.json.",
"See \\Drupal\\Tests\\automatic_updates\\Kernel\\StatusCheck\\StagedProjectsValidatorTest::testErrors()"
],
"packages": [
{
"name": "drupal/core",
"version": "9.8.0",
"type": "drupal-core",
"extra": {
"drupal-scaffold": {
"file-mapping": {}
}
}
},
{
"name": "drupal/test_module",
"version": "1.3.0",
"type": "drupal-module"
},
{
"name": "other/removed",
"description": "This project is removed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
},
{
"name": "other/changed",
"description": "This project version is changed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
},
{
"name": "drupal/dev-test_module",
"version": "1.3.0",
"type": "drupal-module"
},
{
"name": "other/dev-removed",
"description": "This project is removed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
},
{
"name": "other/dev-changed",
"description": "This project version is changed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
}
],
"dev": true,
"dev-package-names": [
"drupal/dev-test_module",
"other/dev-removed",
"other/dev-changed"
]
}
{
"_readme": [
"This file simulates a list of packages installed in the active directory of a virtual project.",
"It will be compared against staged.installed.json.",
"See \\Drupal\\Tests\\automatic_updates\\Kernel\\StatusCheck\\StagedProjectsValidatorTest::testErrors()"
],
"packages": [
{
"name": "drupal/core",
"version": "9.8.0",
"type": "drupal-core",
"extra": {
"drupal-scaffold": {
"file-mapping": {}
}
}
},
{
"name": "drupal/test_theme",
"version": "1.3.0",
"type": "drupal-theme"
},
{
"name": "drupal/test_module2",
"version": "1.3.1",
"type": "drupal-module"
},
{
"name": "other/removed",
"description": "This project is removed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
},
{
"name": "drupal/dev-test_theme",
"version": "1.3.0",
"type": "drupal-custom-theme"
},
{
"name": "drupal/dev-test_module2",
"version": "1.3.1",
"type": "drupal-module"
},
{
"name": "other/dev-removed",
"description": "This project is removed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
}
],
"dev": true,
"dev-package-names": [
"drupal/dev-test_theme",
"drupal/dev-test_module2",
"other/dev-removed"
]
}
{
"_readme": [
"This file simulates a list of packages installed in the active directory of a virtual project.",
"It will be compared against staged.installed.json.",
"See \\Drupal\\Tests\\automatic_updates\\Kernel\\StatusCheck\\StagedProjectsValidatorTest::testErrors()"
],
"packages": [
{
"name": "drupal/core",
"version": "9.8.0",
"type": "drupal-core",
"extra": {
"drupal-scaffold": {
"file-mapping": {}
}
}
},
{
"name": "drupal/test_module",
"version": "1.3.0",
"type": "drupal-module"
},
{
"name": "other/changed",
"description": "This project version is changed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
},
{
"name": "drupal/dev-test_module",
"version": "1.3.0",
"type": "drupal-module"
},
{
"name": "other/dev-changed",
"description": "This project version is changed but there should be no error because it is not a Drupal project.",
"version": "1.3.1",
"type": "library"
}
],
"dev": true,
"dev-package-names": [
"drupal/dev-test_module",
"other/dev-changed"
]
}
......@@ -72,7 +72,30 @@ class StagedProjectsValidatorTest extends AutomaticUpdatesKernelTestBase {
* Tests that an error is raised if Drupal extensions are unexpectedly added.
*/
public function testProjectsAdded(): void {
$this->copyFixtureFolderToActiveDirectory(__DIR__ . '/../../../fixtures/StagedProjectsValidatorTest/new_project_added');
$active_dir = $this->container->get('package_manager.path_locator')
->getProjectRoot();
$this->addPackage($active_dir, [
'name' => 'drupal/test_module',
'version' => '1.3.0',
'type' => 'drupal_module',
]);
$this->addPackage($active_dir, [
'name' => 'other/removed',
'version' => '1.3.1',
'type' => 'library',
]);
$this->addPackage($active_dir, [
'name' => 'drupal/dev-test_module',
'version' => '1.3.0',
'type' => 'drupal_module',
'dev_requirement' => TRUE,
]);
$this->addPackage($active_dir, [
'name' => 'other/dev-removed',
'version' => '1.3.1',
'type' => 'library',
'dev_requirement' => TRUE,
]);
$updater = $this->container->get('automatic_updates.updater');
$updater->begin(['drupal' => '9.8.1']);
......@@ -128,7 +151,41 @@ class StagedProjectsValidatorTest extends AutomaticUpdatesKernelTestBase {
* Tests that errors are raised if Drupal extensions are unexpectedly removed.
*/
public function testProjectsRemoved(): void {
$this->copyFixtureFolderToActiveDirectory(__DIR__ . '/../../../fixtures/StagedProjectsValidatorTest/project_removed');
$active_dir = $this->container->get('package_manager.path_locator')
->getProjectRoot();
$this->addPackage($active_dir, [
'name' => 'drupal/test_theme',
'version' => '1.3.0',
'type' => 'drupal-theme',
]);
$this->addPackage($active_dir, [
'name' => 'drupal/test_module2',
'version' => '1.3.1',
'type' => 'drupal-module',
]);
$this->addPackage($active_dir, [
'name' => 'other/removed',
'version' => '1.3.1',
'type' => 'library',
]);
$this->addPackage($active_dir, [
'name' => 'drupal/dev-test_theme',
'version' => '1.3.0',
'type' => 'drupal-custom-theme',
'dev_requirement' => TRUE,
]);
$this->addPackage($active_dir, [
'name' => 'drupal/dev-test_module2',
'version' => '1.3.1',
'type' => 'drupal-module',
'dev_requirement' => TRUE,
]);
$this->addPackage($active_dir, [
'name' => 'other/dev-removed',
'version' => '1.3.1',
'type' => 'library',
'dev_requirement' => TRUE,
]);
$updater = $this->container->get('automatic_updates.updater');
$updater->begin(['drupal' => '9.8.1']);
......@@ -160,7 +217,30 @@ class StagedProjectsValidatorTest extends AutomaticUpdatesKernelTestBase {
* Tests that errors are raised if Drupal extensions are unexpectedly updated.
*/
public function testVersionsChanged(): void {
$this->copyFixtureFolderToActiveDirectory(__DIR__ . '/../../../fixtures/StagedProjectsValidatorTest/version_changed');
$active_dir = $this->container->get('package_manager.path_locator')
->getProjectRoot();
$this->addPackage($active_dir, [
'name' => 'drupal/test_module',
'version' => '1.3.0',
'type' => 'drupal-module',
]);
$this->addPackage($active_dir, [
'name' => 'other/changed',
'version' => '1.3.1',
'type' => 'library',
]);
$this->addPackage($active_dir, [
'name' => 'drupal/dev-test_module',
'version' => '1.3.0',
'type' => 'drupal-module',
'dev_requirement' => TRUE,
]);
$this->addPackage($active_dir, [
'name' => 'other/dev-changed',
'version' => '1.3.1',
'type' => 'library',
'dev_requirement' => TRUE,
]);
$updater = $this->container->get('automatic_updates.updater');
$updater->begin(['drupal' => '9.8.1']);
......@@ -200,7 +280,41 @@ class StagedProjectsValidatorTest extends AutomaticUpdatesKernelTestBase {
* Tests that no errors occur if only core and its dependencies are updated.
*/
public function testNoErrors(): void {
$this->copyFixtureFolderToActiveDirectory(__DIR__ . '/../../../fixtures/StagedProjectsValidatorTest/no_errors');
$active_dir = $this->container->get('package_manager.path_locator')
->getProjectRoot();
$this->addPackage($active_dir, [
'name' => 'drupal/test_module',
'version' => '1.3.0',
'type' => 'drupal-module',
]);
$this->addPackage($active_dir, [
'name' => 'other/removed',
'version' => '1.3.1',
'type' => 'library',
]);
$this->addPackage($active_dir, [
'name' => 'other/changed',
'version' => '1.3.1',
'type' => 'library',
]);
$this->addPackage($active_dir, [
'name' => 'drupal/dev-test_module',
'version' => '1.3.0',
'type' => 'drupal-module',
'dev_requirement' => TRUE,
]);
$this->addPackage($active_dir, [
'name' => 'other/dev-removed',
'version' => '1.3.1',
'type' => 'library',
'dev_requirement' => TRUE,
]);
$this->addPackage($active_dir, [
'name' => 'other/dev-changed',
'version' => '1.3.1',
'type' => 'library',
'dev_requirement' => TRUE,
]);
$updater = $this->container->get('automatic_updates.updater');
$updater->begin(['drupal' => '9.8.1']);
......
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