Initial Drupal 11 with DDEV setup

This commit is contained in:
gluebox
2025-10-08 11:39:17 -04:00
commit 89ef74b305
25344 changed files with 2599172 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# Why do we need the `updated_module` fixtures?
Because there is a need to thoroughly test the updating of a module. See `\Drupal\Tests\package_manager\Build\PackageUpdateTest`.
This requires 2 versions (`1.0.0` and `1.1.0`) of the same module (`updated_module`), each with a different code bases.
The test updates from one version to the next, and verifies the updated module's code base is actually used after the update: it verifies the updated logic of version of `\Drupal\updated_module\PostApplySubscriber` is being executed.
`\Drupal\fixture_manipulator\FixtureManipulator` cannot manipulate code nor does it modify the file system: it only creates a "skeleton" extension. (See `\Drupal\fixture_manipulator\FixtureManipulator::addProjectAtPath()`.)
# Why do we need the `alpha` fixtures?
To be able to test that `php-tuf/composer-stager` indeed only updates the package for which an update was requested (even though more updates are available), no fixture manipulation is allowed to occur. This requires updating a `path` composer package repository to first serve contain one version of a package, and then another. That is what these fixtures are used for.

View File

@ -0,0 +1,4 @@
name: Alpha
type: module
core_version_requirement: ^9.7 || ^10
project: alpha

View File

@ -0,0 +1,5 @@
{
"name": "drupal/alpha",
"type": "drupal-module",
"version": "1.0.0"
}

View File

@ -0,0 +1,4 @@
name: Alpha
type: module
core_version_requirement: ^9.7 || ^10
project: alpha

View File

@ -0,0 +1,5 @@
{
"name": "drupal/alpha",
"type": "drupal-module",
"version": "1.1.0"
}

View File

@ -0,0 +1,5 @@
{
"name": "drupal/main_module",
"type": "drupal-module",
"version": "1.0.0"
}

View File

@ -0,0 +1,4 @@
name: Main module
type: module
core_version_requirement: ^9 || ^10
project: main_module

View File

@ -0,0 +1,4 @@
name: Main Module Submodule
type: module
core_version_requirement: ^9 || ^10
project: main_module

View File

@ -0,0 +1,5 @@
{
"name": "drupal/updated_module",
"type": "drupal-module",
"version": "1.0.0"
}

View File

@ -0,0 +1,5 @@
name: 'Updated module'
description: 'A module which will change during an update, to ensure that the changes are picked up.'
type: module
package: Testing
project: updated_module

View File

@ -0,0 +1,18 @@
<?php
/**
* @file
* Contains global functions for testing updates to a .module file.
*/
/**
* Page controller that says hello.
*
* @return string[]
* A renderable array of the page content.
*/
function updated_module_hello(): array {
return [
'#markup' => 'Hello!',
];
}

View File

@ -0,0 +1,5 @@
{
"name": "drupal/updated_module",
"type": "drupal-module",
"version": "1.1.0"
}

View File

@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Drupal\updated_module;
use Drupal\package_manager\Event\PostApplyEvent;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Writes a file after staged changes are applied to the active directory.
*
* This event subscriber doesn't exist in version 1.0.0 of this module, so we
* use it to test that new event subscribers are picked up after staged changes
* have been applied.
*/
class PostApplySubscriber implements EventSubscriberInterface {
/**
* The path locator service.
*
* @var \Drupal\package_manager\PathLocator
*/
private $pathLocator;
/**
* Constructs a PostApplySubscriber.
*
* @param \Drupal\package_manager\PathLocator $path_locator
* The path locator service.
*/
public function __construct(PathLocator $path_locator) {
$this->pathLocator = $path_locator;
}
/**
* Writes a file when staged changes are applied to the active directory.
*/
public function postApply(): void {
$dir = $this->pathLocator->getProjectRoot();
file_put_contents("$dir/bravo.txt", 'Bravo!');
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array {
return [
PostApplyEvent::class => 'postApply',
];
}
}

View File

@ -0,0 +1,5 @@
name: 'Updated module'
description: 'A module which will change during an update, to ensure that the changes are picked up.'
type: module
package: Testing
project: updated_module

View File

@ -0,0 +1,18 @@
<?php
/**
* @file
* Contains global functions for testing updates to a .module file.
*/
/**
* Page controller that says hello.
*
* @return string[]
* A renderable array of the page content.
*/
function updated_module_hello(): array {
return [
'#markup' => 'Hello!',
];
}

View File

@ -0,0 +1,7 @@
services:
updated_module.post_apply_subscriber:
class: Drupal\updated_module\PostApplySubscriber
arguments:
- '@Drupal\package_manager\PathLocator'
tags:
- { name: event_subscriber }

View File

@ -0,0 +1,14 @@
<?php
/**
* @file
* Contains a fake database update function for testing.
*/
/**
* Here is a fake update hook.
*
* The schema version is the maximum possible value for a 32-bit integer.
*/
function package_manager_update_2147483647(): void {
}

View File

@ -0,0 +1 @@
# This file should never be staged.

View File

@ -0,0 +1,19 @@
This directory is used as the basis for quasi-functional tests of Package Manager based on `\Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase`. It provides a bare-bones simulation of a real Drupal site layout, including:
* A `.git` directory and `.gitignore` file
* A Drupal core directory with npm modules installed
* An `example` contrib module with its own `.git` directory and npm modules
* A directory in which to store private files (`private`)
* A default site directory with site-specific config files, as well as default versions of them
* A "real" site directory (`example.com`), with a public `files` directory, site-specific config files, and a SQLite database
* A `simpletest` directory containing artifacts from automated tests
* A `vendor` directory to contain installed Composer dependencies
* `composer.json` and `composer.lock` files
Tests which use this mock site will clone it into a temporary location, then run real Composer commands in it, along with other Package Manager operations, and make assertions about the results. It's important to understand that this mock site is not at all bootable or usable as a real Drupal site. But as far as Package Manager and Composer are concerned, it IS a completely valid project that can go through all phases of the stage life cycle.
The files named `ignore.txt` are named that way because Package Manager should ALWAYS ignore them when creating a staged copy of this mock site -- that is, they should never be copied into the stage directory, or removed from their original place, by Package Manager.
The `.git` directories are named `_git` because we cannot commit `.git` directories to our git repository. When a test clones this mock site, these directories are automatically renamed to `.git` in the copy.
This fixture can be re-created at any time by running, from the repository root, `php scripts/PackageManagerFixtureCreator.php`.

View File

@ -0,0 +1,4 @@
This file should never be staged.
The parent directory will be renamed to .git.
@see \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase::createTestProject()

View File

@ -0,0 +1,47 @@
{
"name": "fake/site",
"description": "bull shit",
"version": "1.2.4",
"require": {
"drupal/core-recommended": "9.8.0",
"drupal/core": "9.8.0"
},
"require-dev": {
"drupal/core-dev": "^9"
},
"extra": {
"boo": "boo boo",
"foo": {
"dev": "2.x-dev"
},
"foo-bar": true,
"boo-far": {
"foo": 1.23,
"bar": 134,
"foo-bar": null
},
"baz": null,
"installer-paths": {
"modules/contrib/{$name}": ["type:drupal-module"],
"profiles/contrib/{$name}": ["type:drupal-profile"],
"themes/contrib/{$name}": ["type:drupal-theme"]
}
},
"repositories": {
"fake-packages": {
"type": "composer",
"url": "./"
},
"custom-package": {
"type": "path",
"url": "custom/package"
},
"packagist.org": false
},
"minimum-stability": "stable",
"config": {
"allow-plugins": {
"drupal/core-composer-scaffold": false
}
}
}

View File

@ -0,0 +1,88 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e14b8d5fb12bac6df9c78c41c977e9e5",
"packages": [
{
"name": "drupal/core",
"version": "9.8.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core",
"reference": "31fd2270701526555acae45a3601c777e35508d5"
},
"type": "drupal-core",
"extra": {
"_readme": [
"The 'drupal-scaffold' section below is needed because 'Drupal\\auto_updates\\Validator\\ScaffoldFilePermissionsValidator'",
"uses this section to determine which files to check. The actual composer.json file for drupal/core will have more files listed",
"but this limited list is used in '\\Drupal\\Tests\\auto_updates\\Kernel\\StatusCheck\\ScaffoldFilePermissionsValidatorTest'",
"to ensure this section determines the file list."
],
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[project-root]/recipes/README.txt": "assets/scaffold/files/recipes.README.txt",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
"[web-root]/.htaccess": "assets/scaffold/files/htaccess",
"[web-root]/example.gitignore": "assets/scaffold/files/example.gitignore",
"[web-root]/index.php": "assets/scaffold/files/index.php",
"[web-root]/INSTALL.txt": "assets/scaffold/files/drupal.INSTALL.txt",
"[web-root]/README.md": "assets/scaffold/files/drupal.README.md",
"[web-root]/robots.txt": "assets/scaffold/files/robots.txt",
"[web-root]/update.php": "assets/scaffold/files/update.php",
"[web-root]/sites/README.txt": "assets/scaffold/files/sites.README.txt",
"[web-root]/sites/development.services.yml": "assets/scaffold/files/development.services.yml",
"[web-root]/sites/example.settings.local.php": "assets/scaffold/files/example.settings.local.php",
"[web-root]/sites/example.sites.php": "assets/scaffold/files/example.sites.php",
"[web-root]/sites/default/default.services.yml": "assets/scaffold/files/default.services.yml",
"[web-root]/sites/default/default.settings.php": "assets/scaffold/files/default.settings.php",
"[web-root]/modules/README.txt": "assets/scaffold/files/modules.README.txt",
"[web-root]/profiles/README.txt": "assets/scaffold/files/profiles.README.txt",
"[web-root]/themes/README.txt": "assets/scaffold/files/themes.README.txt"
}
}
},
"description": "A fake version of drupal/core"
},
{
"name": "drupal/core-recommended",
"version": "9.8.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core-recommended",
"reference": "112e4f7cfe8312457cd0eb58dcbffebc148850d8"
},
"type": "project",
"description": "A fake version of drupal/core-recommended"
}
],
"packages-dev": [
{
"name": "drupal/core-dev",
"version": "9.8.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core-dev",
"reference": "b99a99a11ff2779b5e4c5787dc43575382a3548c"
},
"type": "package",
"description": "A fake version of drupal/core-dev"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

View File

@ -0,0 +1,4 @@
This file should never be staged.
The parent directory will be renamed to .git.
@see \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase::createTestProject()

View File

@ -0,0 +1,3 @@
# This file should be staged.
name: Example
type: module

View File

@ -0,0 +1,101 @@
{
"packages": {
"drupal/core-recommended": {
"9.8.0": {
"name": "drupal/core-recommended",
"description": "A fake version of drupal/core-recommended",
"type": "project",
"version": "9.8.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core-recommended",
"reference": "112e4f7cfe8312457cd0eb58dcbffebc148850d8"
}
}
},
"drupal/core-dev": {
"9.8.0": {
"name": "drupal/core-dev",
"description": "A fake version of drupal/core-dev",
"type": "package",
"version": "9.8.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core-dev",
"reference": "b99a99a11ff2779b5e4c5787dc43575382a3548c"
}
}
},
"drupal/core": {
"9.8.0": {
"name": "drupal/core",
"type": "drupal-core",
"description": "A fake version of drupal/core",
"version": "9.8.0",
"extra": {
"_readme": [
"The 'drupal-scaffold' section below is needed because 'Drupal\\auto_updates\\Validator\\ScaffoldFilePermissionsValidator'",
"uses this section to determine which files to check. The actual composer.json file for drupal/core will have more files listed",
"but this limited list is used in '\\Drupal\\Tests\\auto_updates\\Kernel\\StatusCheck\\ScaffoldFilePermissionsValidatorTest'",
"to ensure this section determines the file list."
],
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[project-root]/recipes/README.txt": "assets/scaffold/files/recipes.README.txt",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
"[web-root]/.htaccess": "assets/scaffold/files/htaccess",
"[web-root]/example.gitignore": "assets/scaffold/files/example.gitignore",
"[web-root]/index.php": "assets/scaffold/files/index.php",
"[web-root]/INSTALL.txt": "assets/scaffold/files/drupal.INSTALL.txt",
"[web-root]/README.md": "assets/scaffold/files/drupal.README.md",
"[web-root]/robots.txt": "assets/scaffold/files/robots.txt",
"[web-root]/update.php": "assets/scaffold/files/update.php",
"[web-root]/sites/README.txt": "assets/scaffold/files/sites.README.txt",
"[web-root]/sites/development.services.yml": "assets/scaffold/files/development.services.yml",
"[web-root]/sites/example.settings.local.php": "assets/scaffold/files/example.settings.local.php",
"[web-root]/sites/example.sites.php": "assets/scaffold/files/example.sites.php",
"[web-root]/sites/default/default.services.yml": "assets/scaffold/files/default.services.yml",
"[web-root]/sites/default/default.settings.php": "assets/scaffold/files/default.settings.php",
"[web-root]/modules/README.txt": "assets/scaffold/files/modules.README.txt",
"[web-root]/profiles/README.txt": "assets/scaffold/files/profiles.README.txt",
"[web-root]/themes/README.txt": "assets/scaffold/files/themes.README.txt"
}
}
},
"dist": {
"type": "path",
"url": "../path_repos/drupal--core",
"reference": "31fd2270701526555acae45a3601c777e35508d5"
}
}
},
"cweagans/composer-patches": {
"1.7.333": {
"name": "cweagans/composer-patches",
"description": "A fake version of cweagans/composer-patches",
"type": "composer-plugin",
"version": "1.7.333",
"extra": {
"class": "\\cweagans\\Fake\\ComposerPatches"
},
"dist": {
"type": "path",
"url": "../path_repos/cweagans--composer-patches"
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0"
},
"autoload": {
"psr-4": {
"cweagans\\Fake\\": "src"
}
}
}
}
}
}

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1,2 @@
# This file should be staged because it's scaffolded into place by Drupal core.
services: {}

View File

@ -0,0 +1,6 @@
<?php
/**
* @file
* This file should be staged because it's scaffolded into place by Drupal core.
*/

View File

@ -0,0 +1,2 @@
# This file should never be staged.
must_not_be: 'empty'

View File

@ -0,0 +1,6 @@
<?php
/**
* @file
* This file should never be staged.
*/

View File

@ -0,0 +1,6 @@
<?php
/**
* @file
* This file should never be staged.
*/

View File

@ -0,0 +1 @@
This file should be staged.

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1,2 @@
# This file should never be staged.
key: "value"

View File

@ -0,0 +1,6 @@
<?php
/**
* @file
* This file should never be staged.
*/

View File

@ -0,0 +1,6 @@
<?php
/**
* @file
* This file should never be staged.
*/

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1 @@
# This file should never be staged.

View File

@ -0,0 +1,85 @@
{
"packages": [
{
"name": "drupal/core",
"version": "9.8.0",
"version_normalized": "9.8.0.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core",
"reference": "31fd2270701526555acae45a3601c777e35508d5"
},
"type": "drupal-core",
"extra": {
"_readme": [
"The 'drupal-scaffold' section below is needed because 'Drupal\\auto_updates\\Validator\\ScaffoldFilePermissionsValidator'",
"uses this section to determine which files to check. The actual composer.json file for drupal/core will have more files listed",
"but this limited list is used in '\\Drupal\\Tests\\auto_updates\\Kernel\\StatusCheck\\ScaffoldFilePermissionsValidatorTest'",
"to ensure this section determines the file list."
],
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[project-root]/recipes/README.txt": "assets/scaffold/files/recipes.README.txt",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
"[web-root]/.htaccess": "assets/scaffold/files/htaccess",
"[web-root]/example.gitignore": "assets/scaffold/files/example.gitignore",
"[web-root]/index.php": "assets/scaffold/files/index.php",
"[web-root]/INSTALL.txt": "assets/scaffold/files/drupal.INSTALL.txt",
"[web-root]/README.md": "assets/scaffold/files/drupal.README.md",
"[web-root]/robots.txt": "assets/scaffold/files/robots.txt",
"[web-root]/update.php": "assets/scaffold/files/update.php",
"[web-root]/sites/README.txt": "assets/scaffold/files/sites.README.txt",
"[web-root]/sites/development.services.yml": "assets/scaffold/files/development.services.yml",
"[web-root]/sites/example.settings.local.php": "assets/scaffold/files/example.settings.local.php",
"[web-root]/sites/example.sites.php": "assets/scaffold/files/example.sites.php",
"[web-root]/sites/default/default.services.yml": "assets/scaffold/files/default.services.yml",
"[web-root]/sites/default/default.settings.php": "assets/scaffold/files/default.settings.php",
"[web-root]/modules/README.txt": "assets/scaffold/files/modules.README.txt",
"[web-root]/profiles/README.txt": "assets/scaffold/files/profiles.README.txt",
"[web-root]/themes/README.txt": "assets/scaffold/files/themes.README.txt"
}
}
},
"installation-source": "dist",
"description": "A fake version of drupal/core",
"install-path": "../drupal/core"
},
{
"name": "drupal/core-dev",
"version": "9.8.0",
"version_normalized": "9.8.0.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core-dev",
"reference": "b99a99a11ff2779b5e4c5787dc43575382a3548c"
},
"type": "package",
"installation-source": "dist",
"description": "A fake version of drupal/core-dev",
"install-path": "../drupal/core-dev"
},
{
"name": "drupal/core-recommended",
"version": "9.8.0",
"version_normalized": "9.8.0.0",
"dist": {
"type": "path",
"url": "../path_repos/drupal--core-recommended",
"reference": "112e4f7cfe8312457cd0eb58dcbffebc148850d8"
},
"type": "project",
"installation-source": "dist",
"description": "A fake version of drupal/core-recommended",
"install-path": "../drupal/core-recommended"
}
],
"dev": true,
"dev-package-names": [
"drupal/core-dev"
]
}

View File

@ -0,0 +1,56 @@
<?php
/**
* @file
*/
return [
'root' => [
'name' => 'fake/site',
'pretty_version' => '1.2.4',
'version' => '1.2.4.0',
'reference' => NULL,
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => [],
'dev' => TRUE,
],
'versions' => [
'drupal/core' => [
'pretty_version' => '9.8.0',
'version' => '9.8.0.0',
'reference' => '31fd2270701526555acae45a3601c777e35508d5',
'type' => 'drupal-core',
'install_path' => __DIR__ . '/../drupal/core',
'aliases' => [],
'dev_requirement' => FALSE,
],
'drupal/core-dev' => [
'pretty_version' => '9.8.0',
'version' => '9.8.0.0',
'reference' => 'b99a99a11ff2779b5e4c5787dc43575382a3548c',
'type' => 'package',
'install_path' => __DIR__ . '/../drupal/core-dev',
'aliases' => [],
'dev_requirement' => TRUE,
],
'drupal/core-recommended' => [
'pretty_version' => '9.8.0',
'version' => '9.8.0.0',
'reference' => '112e4f7cfe8312457cd0eb58dcbffebc148850d8',
'type' => 'project',
'install_path' => __DIR__ . '/../drupal/core-recommended',
'aliases' => [],
'dev_requirement' => FALSE,
],
'fake/site' => [
'pretty_version' => '1.2.4',
'version' => '1.2.4.0',
'reference' => NULL,
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => [],
'dev_requirement' => FALSE,
],
],
];

View File

@ -0,0 +1 @@
{"name":"drupal\/core-dev","description": "A fake version of drupal/core-dev","type":"package","version":"9.8.0"}

View File

@ -0,0 +1 @@
{"name":"drupal/core-recommended","description": "A fake version of drupal/core-recommended","type":"project","version":"9.8.0"}

View File

@ -0,0 +1,41 @@
{
"name": "drupal/core",
"type": "drupal-core",
"description": "A fake version of drupal/core",
"version": "9.8.0",
"extra": {
"_readme": [
"The 'drupal-scaffold' section below is needed because 'Drupal\\auto_updates\\Validator\\ScaffoldFilePermissionsValidator'",
"uses this section to determine which files to check. The actual composer.json file for drupal/core will have more files listed",
"but this limited list is used in '\\Drupal\\Tests\\auto_updates\\Kernel\\StatusCheck\\ScaffoldFilePermissionsValidatorTest'",
"to ensure this section determines the file list."
],
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[project-root]/recipes/README.txt": "assets/scaffold/files/recipes.README.txt",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
"[web-root]/.htaccess": "assets/scaffold/files/htaccess",
"[web-root]/example.gitignore": "assets/scaffold/files/example.gitignore",
"[web-root]/index.php": "assets/scaffold/files/index.php",
"[web-root]/INSTALL.txt": "assets/scaffold/files/drupal.INSTALL.txt",
"[web-root]/README.md": "assets/scaffold/files/drupal.README.md",
"[web-root]/robots.txt": "assets/scaffold/files/robots.txt",
"[web-root]/update.php": "assets/scaffold/files/update.php",
"[web-root]/sites/README.txt": "assets/scaffold/files/sites.README.txt",
"[web-root]/sites/development.services.yml": "assets/scaffold/files/development.services.yml",
"[web-root]/sites/example.settings.local.php": "assets/scaffold/files/example.settings.local.php",
"[web-root]/sites/example.sites.php": "assets/scaffold/files/example.sites.php",
"[web-root]/sites/default/default.services.yml": "assets/scaffold/files/default.services.yml",
"[web-root]/sites/default/default.settings.php": "assets/scaffold/files/default.settings.php",
"[web-root]/modules/README.txt": "assets/scaffold/files/modules.README.txt",
"[web-root]/profiles/README.txt": "assets/scaffold/files/profiles.README.txt",
"[web-root]/themes/README.txt": "assets/scaffold/files/themes.README.txt"
}
}
}
}

View File

@ -0,0 +1 @@
This file should never be staged.

View File

@ -0,0 +1,15 @@
{
"name": "cweagans/composer-patches",
"description": "A fake version of cweagans/composer-patches",
"type": "composer-plugin",
"version": "1.7.333",
"extra": {
"class": "\\cweagans\\Fake\\ComposerPatches"
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0"
},
"autoload": {
"psr-4": {"cweagans\\Fake\\": "src"}
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace cweagans\Fake;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
/**
* Dummy composer plugin implementation.
*/
class ComposerPatches implements PluginInterface {
/**
* {@inheritdoc}
*/
public function activate(Composer $composer, IOInterface $io) {}
/**
* {@inheritdoc}
*/
public function deactivate(Composer $composer, IOInterface $io) {}
/**
* {@inheritdoc}
*/
public function uninstall(Composer $composer, IOInterface $io) {}
}

View File

@ -0,0 +1 @@
{"name":"drupal\/core-dev","description": "A fake version of drupal/core-dev","type":"package","version":"9.8.0"}

View File

@ -0,0 +1 @@
{"name":"drupal/core-recommended","description": "A fake version of drupal/core-recommended","type":"project","version":"9.8.0"}

View File

@ -0,0 +1,41 @@
{
"name": "drupal/core",
"type": "drupal-core",
"description": "A fake version of drupal/core",
"version": "9.8.0",
"extra": {
"_readme": [
"The 'drupal-scaffold' section below is needed because 'Drupal\\auto_updates\\Validator\\ScaffoldFilePermissionsValidator'",
"uses this section to determine which files to check. The actual composer.json file for drupal/core will have more files listed",
"but this limited list is used in '\\Drupal\\Tests\\auto_updates\\Kernel\\StatusCheck\\ScaffoldFilePermissionsValidatorTest'",
"to ensure this section determines the file list."
],
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[project-root]/recipes/README.txt": "assets/scaffold/files/recipes.README.txt",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
"[web-root]/.htaccess": "assets/scaffold/files/htaccess",
"[web-root]/example.gitignore": "assets/scaffold/files/example.gitignore",
"[web-root]/index.php": "assets/scaffold/files/index.php",
"[web-root]/INSTALL.txt": "assets/scaffold/files/drupal.INSTALL.txt",
"[web-root]/README.md": "assets/scaffold/files/drupal.README.md",
"[web-root]/robots.txt": "assets/scaffold/files/robots.txt",
"[web-root]/update.php": "assets/scaffold/files/update.php",
"[web-root]/sites/README.txt": "assets/scaffold/files/sites.README.txt",
"[web-root]/sites/development.services.yml": "assets/scaffold/files/development.services.yml",
"[web-root]/sites/example.settings.local.php": "assets/scaffold/files/example.settings.local.php",
"[web-root]/sites/example.sites.php": "assets/scaffold/files/example.sites.php",
"[web-root]/sites/default/default.services.yml": "assets/scaffold/files/default.services.yml",
"[web-root]/sites/default/default.settings.php": "assets/scaffold/files/default.settings.php",
"[web-root]/modules/README.txt": "assets/scaffold/files/modules.README.txt",
"[web-root]/profiles/README.txt": "assets/scaffold/files/profiles.README.txt",
"[web-root]/themes/README.txt": "assets/scaffold/files/themes.README.txt"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"name": "drupal/main_module_submodule",
"type": "metapackage",
"version": "1.0.0",
"require": {
"drupal/main_module": "*"
}
}

View File

@ -0,0 +1,12 @@
<?php
/**
* @file
* Contains a fake database post-update function for testing.
*/
/**
* Here is a fake post-update hook.
*/
function package_manager_post_update_test(): void {
}

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\SupportedReleaseValidatorTest.
Contains metadata about the following (fake) releases of aaa_update_test module, all of which are secure, in order:
- 8.x-3.0, which is in an unsupported branch
- 8.x-2.1
- 8.x-2.1-beta1
- 8.x-2.1-alpha1
- 8.x-2.0
- 8.x-2.0-beta1
- 8.x-2.0-alpha1
- 8.x-1.1
- 8.x-1.1-beta1
- 8.x-1.1-alpha1
- 8.x-1.0
- 8.x-1.0-beta1
- 8.x-1.0-alpha1
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>AAA Update test</title>
<short_name>aaa_update_test</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>8.x-2.,8.x-1.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/aaa_update_test</link>
<terms>
<term><name>Projects</name><value>AAA Update test project</value></term>
</terms>
<releases>
<release>
<name>AAA Update test 8.x-3.0</name>
<version>8.x-3.0</version>
<tag>8.x-3.0</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-3-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-3-0.tar.gz</download_link>
<date>1584195300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-2.1</name>
<version>8.x-2.1</version>
<tag>8.x-2.1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-1.tar.gz</download_link>
<date>1581603300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-2.1-beta1</name>
<version>8.x-2.1-beta1</version>
<tag>8.x-2.1-beta1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-1-beta1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-1-beta1.tar.gz</download_link>
<date>1579011300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-2.1-alpha1</name>
<version>8.x-2.1-alpha1</version>
<tag>8.x-2.1-alpha1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-1-alpha1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-1-alpha1.tar.gz</download_link>
<date>1576419300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-2.0</name>
<version>8.x-2.0</version>
<tag>8.x-2.0</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-0.tar.gz</download_link>
<date>1573827300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-2.0-beta1</name>
<version>8.x-2.0-beta1</version>
<tag>8.x-2.0-beta1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-0-beta1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-0-beta1.tar.gz</download_link>
<date>1571235300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-2.0-alpha1</name>
<version>8.x-2.0-alpha1</version>
<tag>8.x-2.0-alpha1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-2-0-alpha1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-2-0-alpha1.tar.gz</download_link>
<date>1568643300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-1.1</name>
<version>8.x-1.1</version>
<tag>8.x-1.1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1.tar.gz</download_link>
<date>1566051300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-1.1-beta1</name>
<version>8.x-1.1-beta1</version>
<tag>8.x-1.1-beta1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-beta1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1-beta1.tar.gz</download_link>
<date>1563459300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-1.1-alpha1</name>
<version>8.x-1.1-alpha1</version>
<tag>8.x-1.1-alpha1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-1-alpha1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-1-alpha1.tar.gz</download_link>
<date>1560867300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-1.0</name>
<version>8.x-1.0</version>
<tag>8.x-1.0</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0.tar.gz</download_link>
<date>1558275300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-1.0-beta1</name>
<version>8.x-1.0-beta1</version>
<tag>8.x-1.0-beta1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-beta1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0-beta1.tar.gz</download_link>
<date>1555683300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>AAA Update test 8.x-1.0-alpha1</name>
<version>8.x-1.0-alpha1</version>
<tag>8.x-1.0-alpha1</tag>
<status>published</status>
<release_link>http://example.com/aaa_update_test-8-x-1-0-alpha1-release</release_link>
<download_link>http://example.com/aaa_update_test-8-x-1-0-alpha1.tar.gz</download_link>
<date>1553091300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Build\PackageInstallTest.
Contains metadata about the following (fake) releases of alpha module, all of which are secure, in order:
- 1.1.0
- 1.0.0
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Alpha</title>
<short_name>alpha</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>1.1.,1.0.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/alpha</link>
<terms>
<term><name>Projects</name><value>Alpha project</value></term>
</terms>
<releases>
<release>
<name>Alpha 1.1.0</name>
<version>1.1.0</version>
<tag>1.1.0</tag>
<status>published</status>
<release_link>http://example.com/alpha-1-1-0-release</release_link>
<download_link>http://example.com/alpha-1-1-0.tar.gz</download_link>
<date>1584195300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Alpha 1.0.0</name>
<version>1.0.0</version>
<tag>1.0.0</tag>
<status>published</status>
<release_link>http://example.com/alpha-1-0-0-release</release_link>
<download_link>http://example.com/alpha-1-0-0.tar.gz</download_link>
<date>1581603300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by:
- \Drupal\Tests\package_manager\Kernel\ProjectInfoTest
- \Drupal\Tests\auto_updates\Functional\UpdaterFormTest
Contains metadata about the following (fake) releases of Drupal core, all of which are secure, in order:
- 10.0.0
- 9.7.2
- 9.7.1
- 9.7.0
- 9.6.1
- 9.6.0
- 9.5.1
- 9.5.0
- 9.4.0, which is in an unsupported branch
- 9.7.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.5.,9.6.,9.7.,10.0.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 10.0.0</name>
<version>10.0.0</version>
<status>published</status>
<release_link>http://example.com/drupal-10-0-0-release</release_link>
<download_link>http://example.com/drupal-10-0-0.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.2</name>
<version>9.7.2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-2-release</release_link>
<download_link>http://example.com/drupal-9-7-2.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.1</name>
<version>9.6.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-1-release</release_link>
<download_link>http://example.com/drupal-9-6-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0</name>
<version>9.6.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-release</release_link>
<download_link>http://example.com/drupal-9-6-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.5.1</name>
<version>9.5.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-5-1-release</release_link>
<download_link>http://example.com/drupal-9-5-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.5.0</name>
<version>9.5.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-5-0-release</release_link>
<download_link>http://example.com/drupal-9-5-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.4.0</name>
<version>9.4.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-4-0-release</release_link>
<download_link>http://example.com/drupal-9-4-0.tar.gz</download_link>
<date>1240424421</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.x-dev</name>
<version>9.7.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-7-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\ProjectInfoTest.
Contains metadata about the following (fake) releases of Drupal core, all of which are secure, in order:
- 9.8.0-alpha1
- 9.7.1
- 9.7.0
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.7.,9.8.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.0-alpha1</name>
<version>9.8.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\auto_updates\Functional\UpdaterFormTest.
Contains metadata about the following (fake) releases of Drupal core, in order:
- 9.8.0-beta1
- 9.7.0
- 9.8.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.8.,9.7.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.0-beta1</name>
<version>9.8.0-beta1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-beta1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-beta1-.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\auto_updates\Functional\UpdaterFormTest.
Contains metadata about the following (fake) releases of Drupal core, in order:
- 9.8.0-rc1
- 9.7.0
- 9.8.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.8.,9.7.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.0-rc1</name>
<version>9.8.0-rc1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-rc1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-rc1-.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\ProjectInfoTest.
Contains metadata about releases of Drupal core with no supported branches:
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches/>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
</project>

View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\auto_updates\Kernel\StatusCheck\VersionPolicyValidatorTest.
Contains metadata about the following (fake) releases of Drupal core, all of which are secure, in order:
- 9.8.1-rc3
- 9.8.1-beta2
- 9.8.1-alpha1
- 9.7.1
- 9.7.0
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.7.,9.8.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.1-rc3</name>
<version>9.8.1-rc3</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-rc3-release</release_link>
<download_link>http://example.com/drupal-9-8-1-rc3.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1-beta2</name>
<version>9.8.1-beta2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-beta2-release</release_link>
<download_link>http://example.com/drupal-9-8-1-beta2.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1-alpha1</name>
<version>9.8.1-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-1-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1-beta2</name>
<version>9.8.1-beta2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-beta2-release</release_link>
<download_link>http://example.com/drupal-9-8-1-beta2.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0</name>
<version>9.8.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-release</release_link>
<download_link>http://example.com/drupal-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Insecure</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by:
- \Drupal\Tests\auto_updates_extensions\Build\ModuleUpdateTest
- \Drupal\Tests\package_manager\Kernel\ProjectInfoTest
- \Drupal\Tests\auto_updates\Build\CoreUpdateTest
- \Drupal\Tests\auto_updates\Functional\AvailableUpdatesReportTest
- \Drupal\Tests\auto_updates\Functional\ClickableHelpTest
- \Drupal\Tests\auto_updates\Functional\StatusCheckTest
- \Drupal\Tests\auto_updates\Functional\UpdaterFormNoRecommendedReleaseMessageTest
- \Drupal\Tests\auto_updates\Kernel\CronUpdaterTest
- \Drupal\Tests\auto_updates\Kernel\UpdaterTest
- \Drupal\Tests\auto_updates\Kernel\StatusCheck\CronFrequencyValidatorTest
- \Drupal\Tests\auto_updates\Kernel\StatusCheck\StatusCheckerTest
- \Drupal\Tests\auto_updates\Kernel\StatusCheck\VersionPolicyValidatorTest
Contains metadata about the following (fake) releases of Drupal core, in order:
- 9.8.1, which is a security release
- 9.8.0, which is insecure
- 9.8.0-alpha1, which is insecure
- 9.8.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.8.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.1</name>
<version>9.8.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-release</release_link>
<download_link>http://example.com/drupal-9-8-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Security update</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0</name>
<version>9.8.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-release</release_link>
<download_link>http://example.com/drupal-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Insecure</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0-alpha1</name>
<version>9.8.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-alpha1-.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Insecure</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\ProjectInfoTest.
Contains metadata about releases of Drupal core with <supported_branches></supported_branches> not set:
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
</project>

View File

@ -0,0 +1,216 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by:
- \Drupal\Tests\package_manager\Kernel\ProjectInfoTest
- \Drupal\Tests\auto_updates\Functional\AvailableUpdatesReportTest
- \Drupal\Tests\auto_updates\Kernel\ReleaseChooserTest
Contains metadata about the following (fake) releases of Drupal core, in order:
- 9.8.2
- 9.8.1, which is a security update
- 9.8.1-beta1, which is a security update
- 9.8.0, which is insecure
- 9.8.0-alpha1
- 9.7.1, which is a security update
- 9.7.0, which is insecure
- 9.7.0-alpha1
- 9.8.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.7.,9.8.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.2</name>
<version>9.8.2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-2-release</release_link>
<download_link>http://example.com/drupal-9-8-2.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1</name>
<version>9.8.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-release</release_link>
<download_link>http://example.com/drupal-9-8-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Security update</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1-beta1</name>
<version>9.8.1-beta1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-beta1-release</release_link>
<download_link>http://example.com/drupal-9-8-1-beta1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Security release</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0</name>
<version>9.8.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-release</release_link>
<download_link>http://example.com/drupal-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Insecure</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0-alpha1</name>
<version>9.8.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Security update</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Insecure</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0-alpha1</name>
<version>9.7.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-7-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by:
- \Drupal\Tests\package_manager\Kernel\ProjectInfoTest
- \Drupal\Tests\auto_updates\Kernel\StatusCheck\VersionPolicyValidatorTest
Contains metadata about the following (fake) releases of Drupal core, in order:
- 9.8.2
- 9.8.1, which is unsupported
- 9.8.0, which is unpublished
- 9.8.0-alpha1
- 9.7.1
- 9.7.0
- 9.7.0-alpha1
- 9.6.1, which is in an unsupported branch
- 9.6.0, which is in an unsupported branch
- 9.6.0, which is in an unsupported branch
- 9.8.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.7.,9.8.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.2</name>
<version>9.8.2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-2-release</release_link>
<download_link>http://example.com/drupal-9-8-2.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1</name>
<version>9.8.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-release</release_link>
<download_link>http://example.com/drupal-9-8-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>Unsupported</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0</name>
<version>9.8.0</version>
<status>unpublished</status>
<release_link>http://example.com/drupal-9-8-0-release</release_link>
<download_link>http://example.com/drupal-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0-alpha1</name>
<version>9.8.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0-alpha1</name>
<version>9.7.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-7-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.1</name>
<version>9.6.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-1-release</release_link>
<download_link>http://example.com/drupal-9-6-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0</name>
<version>9.6.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-release</release_link>
<download_link>http://example.com/drupal-9-6-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0-alpha1</name>
<version>9.6.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-6-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by:
- \Drupal\Tests\auto_updates_extensions\Functional\UpdaterFormTest
- \Drupal\Tests\auto_updates_extensions\Kernel\Validator\UpdateReleaseValidatorTest
- \Drupal\Tests\package_manager\Kernel\ProjectInfoTest
- \Drupal\Tests\package_manager\Kernel\SupportedReleaseValidatorTest
- \Drupal\Tests\auto_updates\Functional\AvailableUpdatesReportTest
- \Drupal\Tests\auto_updates\Functional\UpdaterFormNoRecommendedReleaseMessageTest
- \Drupal\Tests\auto_updates\Functional\UpdaterFormTest
- \Drupal\Tests\auto_updates\Kernel\CronUpdaterTest
- \Drupal\Tests\auto_updates\Kernel\StatusCheck\VersionPolicyValidatorTest
- \Drupal\Tests\auto_updates\Kernel\StatusCheck\VersionPolicy\SupportedBranchInstalledTest
Contains metadata about the following (fake) releases of Drupal core, all of which are secure, in order:
- 9.8.2
- 9.8.1
- 9.8.0
- 9.8.0-alpha1
- 9.7.1
- 9.7.0
- 9.7.0-alpha1
- 9.6.1, which is in an unsupported branch
- 9.6.0, which is in an unsupported branch
- 9.6.0, which is in an unsupported branch
- 9.8.x-dev
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.7.,9.8.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.2</name>
<version>9.8.2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-2-release</release_link>
<download_link>http://example.com/drupal-9-8-2.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1</name>
<version>9.8.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-release</release_link>
<download_link>http://example.com/drupal-9-8-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0</name>
<version>9.8.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-release</release_link>
<download_link>http://example.com/drupal-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0-alpha1</name>
<version>9.8.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0-alpha1</name>
<version>9.7.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-7-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.1</name>
<version>9.6.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-1-release</release_link>
<download_link>http://example.com/drupal-9-6-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0</name>
<version>9.6.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-release</release_link>
<download_link>http://example.com/drupal-9-6-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0-alpha1</name>
<version>9.6.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-6-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\ProjectInfoTest.
Contains metadata about the following (fake) releases of Drupal core, in order:
- 9.8.2
- 9.8.1
- 9.8.0
- 9.8.0-alpha1
- 9.7.1
- 9.7.0
- 9.7.0-alpha1
- 9.6.1, which is in an unsupported branch
- 9.6.0, which is in an unsupported branch
- 9.6.0, which is in an unsupported branch
- 9.8.x-dev
What's special about this file is that the project as a whole has a status other than "published".
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>9.7.,9.8.</supported_branches>
<project_status>any status besides published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term>
<name>Projects</name>
<value>Drupal project</value>
</term>
</terms>
<releases>
<release>
<name>Drupal 9.8.2</name>
<version>9.8.2</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-2-release</release_link>
<download_link>http://example.com/drupal-9-8-2.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.1</name>
<version>9.8.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-1-release</release_link>
<download_link>http://example.com/drupal-9-8-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0</name>
<version>9.8.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-release</release_link>
<download_link>http://example.com/drupal-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.0-alpha1</name>
<version>9.8.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-8-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.1</name>
<version>9.7.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-1-release</release_link>
<download_link>http://example.com/drupal-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0</name>
<version>9.7.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-release</release_link>
<download_link>http://example.com/drupal-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.7.0-alpha1</name>
<version>9.7.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-7-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-7-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.1</name>
<version>9.6.1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-1-release</release_link>
<download_link>http://example.com/drupal-9-6-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0</name>
<version>9.6.0</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-release</release_link>
<download_link>http://example.com/drupal-9-6-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.6.0-alpha1</name>
<version>9.6.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/drupal-9-6-0-alpha1-release</release_link>
<download_link>http://example.com/drupal-9-6-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
<release>
<name>Drupal 9.8.x-dev</name>
<version>9.8.x-dev</version>
<status>published</status>
<release_link>http://example.com/drupal-9-8-x-dex-release</release_link>
<download_link>http://example.com/drupal-9-8-x-dex.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term>
<name>Release type</name>
<value>New features</value>
</term>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Build\PackageInstallTest.
Contains metadata about the following (fake) releases of main_module, all of which are secure, in order:
- 1.0.0
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Main Module</title>
<short_name>main_module</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>1.0.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/main_module</link>
<terms>
<term><name>Projects</name><value>Main Module project</value></term>
</terms>
<releases>
<release>
<name>Main Module 1.0.0</name>
<version>1.0.0</version>
<tag>1.0.0</tag>
<status>published</status>
<release_link>http://example.com/main_module-1-0-0-release</release_link>
<download_link>http://example.com/main_module-1-0-0.tar.gz</download_link>
<date>1584195300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by:
- \Drupal\Tests\package_manager\Kernel\SupportedReleaseValidatorTest
- \Drupal\Tests\package_manager\Kernel\ProjectInfoTest
Contains metadata about the following (fake) releases of package_manager_test_update module, all of which are secure, in order:
- 7.0.1
- 7.0.0
- 7.0.0-alpha1
- 8.x-6.2
- 8.x-6.1
- 8.x-6.0
- 8.x-6.0-alpha1
- 7.0.x-dev
- 8.x-6.x-dev
- 8.x-5.x - An invalid release to ensure invalid releases do not affect processing other releases.
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Package Manager Test Update</title>
<short_name>package_manager_test_update</short_name>
<dc:creator>Package Manager</dc:creator>
<supported_branches>7.0.,8.x-6.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/package_manager_test_update</link>
<terms>
<term><name>Projects</name><value>Package Manager Test Update project</value></term>
</terms>
<releases>
<release>
<name>Package Manager Test Update 7.0.1</name>
<version>7.0.1</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-7-1-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-7-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 7.0.0</name>
<version>7.0.0</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-7-0-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-7-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 7.0.0-alpha1</name>
<version>7.0.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-7-0-alpha1-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-7-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 8.x-6.2</name>
<version>8.x-6.2</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-8-2-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-8-2.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 8.x-6.1</name>
<version>8.x-6.1</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-8-1-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-8-1.tar.gz</download_link>
<date>1250425521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 8.x-6.0</name>
<version>8.x-6.0</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-8-0-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-8-0.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 8.x-6.0-alpha1</name>
<version>8.x-6.0-alpha1</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-8-0-alpha1-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-8-0-alpha1.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 7.0.0-dev</name>
<version>7.0.x-dev</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-7-0-dev-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-7-0-dev.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 8.x-6.x-dev</name>
<version>8.x-6.x-dev</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-8-0-dev-release</release_link>
<download_link>http://example.com/package_manager_test_update-9-8-0-dev.tar.gz</download_link>
<date>1250424521</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Test Update 8.x-5.x</name>
<version>8.x-5.x</version>
<status>published</status>
<release_link>http://example.com/package_manager_test_update-9-5-0-dev-release</release_link>
<download_link/>
<date/>
<filesize/>
<files>
<file>
<url/>
<archive_type/>
<md5/>
<size/>
</file>
<file>
<url/>
<archive_type/>
<md5/>
<size/>
</file>
</files>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\SupportedReleaseValidatorTest.
Contains metadata about the following (fake) releases of Package Manager Theme, all of which are secure, in order:
- 8.2.0, which is in an unsupported branch
- 8.1.1
- 8.1.0
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Package Manager Theme</title>
<short_name>package_manager_theme</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>8.0.,8.1.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/package_manager_theme</link>
<terms>
<term><name>Projects</name><value>Package Manager Theme project</value></term>
</terms>
<releases>
<release>
<name>Package Manager Theme 8.2.0</name>
<version>8.2.0</version>
<tag>8.2.0</tag>
<status>published</status>
<release_link>http://example.com/package_manager_theme-8-2-0-release</release_link>
<download_link>http://example.com/package_manager_theme-8-2-0.tar.gz</download_link>
<date>1584195300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Theme 8.1.1</name>
<version>8.1.1</version>
<tag>8.1.1</tag>
<status>published</status>
<release_link>http://example.com/package_manager_theme-8-1-1-release</release_link>
<download_link>http://example.com/package_manager_theme-8-1-1.tar.gz</download_link>
<date>1581603300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Package Manager Theme 8.1.0</name>
<version>8.1.0</version>
<tag>8.1.0</tag>
<status>published</status>
<release_link>http://example.com/package_manager_theme-8-1-0-release</release_link>
<download_link>http://example.com/package_manager_theme-8-1-0.tar.gz</download_link>
<date>1573827300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Kernel\SupportedReleaseValidatorTest.
Contains metadata about the following (fake) releases of semver_test module, all of which are secure, in order:
- 8.2.0, which is in an unsupported branch
- 8.1.1
- 8.1.1-beta1
- 8.1.1-alpha1
- 8.1.0
- 8.1.0-beta1
- 8.1.0-alpha1
- 8.0.1
- 8.0.1-beta1
- 8.0.1-alpha1
- 8.0.0
- 8.0.0-beta1
- 8.0.0-alpha1
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Semver Test</title>
<short_name>semver_test</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>8.0.,8.1.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/semver_test</link>
<terms>
<term><name>Projects</name><value>Semver Test project</value></term>
</terms>
<releases>
<release>
<name>Semver Test 8.2.0</name>
<version>8.2.0</version>
<tag>8.2.0</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-2-0-release</release_link>
<download_link>http://example.com/semver_test-8-2-0.tar.gz</download_link>
<date>1584195300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.1.1</name>
<version>8.1.1</version>
<tag>8.1.1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-1-1-release</release_link>
<download_link>http://example.com/semver_test-8-1-1.tar.gz</download_link>
<date>1581603300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.1.1-beta1</name>
<version>8.1.1-beta1</version>
<tag>8.1.1-beta1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-1-1-beta1-release</release_link>
<download_link>http://example.com/semver_test-8-1-1-beta1.tar.gz</download_link>
<date>1579011300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.1.1-alpha1</name>
<version>8.1.1-alpha1</version>
<tag>8.1.1-alpha1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-1-1-alpha1-release</release_link>
<download_link>http://example.com/semver_test-8-1-1-alpha1.tar.gz</download_link>
<date>1576419300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.1.0</name>
<version>8.1.0</version>
<tag>8.1.0</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-1-0-release</release_link>
<download_link>http://example.com/semver_test-8-1-0.tar.gz</download_link>
<date>1573827300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.1.0-beta1</name>
<version>8.1.0-beta1</version>
<tag>8.1.0-beta1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-1-0-beta1-release</release_link>
<download_link>http://example.com/semver_test-8-1-0-beta1.tar.gz</download_link>
<date>1571235300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.1.0-alpha1</name>
<version>8.1.0-alpha1</version>
<tag>8.1.0-alpha1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-1-0-alpha1-release</release_link>
<download_link>http://example.com/semver_test-8-1-0-alpha1.tar.gz</download_link>
<date>1568643300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.0.1</name>
<version>8.0.1</version>
<tag>8.0.1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-0-1-release</release_link>
<download_link>http://example.com/semver_test-8-0-1.tar.gz</download_link>
<date>1566051300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.0.1-beta1</name>
<version>8.0.1-beta1</version>
<tag>8.0.1-beta1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-0-1-beta1-release</release_link>
<download_link>http://example.com/semver_test-8-0-1-beta1.tar.gz</download_link>
<date>1563459300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.0.1-alpha1</name>
<version>8.0.1-alpha1</version>
<tag>8.0.1-alpha1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-0-1-alpha1-release</release_link>
<download_link>http://example.com/semver_test-8-0-1-alpha1.tar.gz</download_link>
<date>1560867300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.0.0</name>
<version>8.0.0</version>
<tag>8.0.0</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-0-0-release</release_link>
<download_link>http://example.com/semver_test-8-0-0.tar.gz</download_link>
<date>1558275300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.0.0-beta1</name>
<version>8.0.0-beta1</version>
<tag>8.0.0-beta1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-0-0-beta1-release</release_link>
<download_link>http://example.com/semver_test-8-0-0-beta1.tar.gz</download_link>
<date>1555683300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Semver Test 8.0.0-alpha1</name>
<version>8.0.0-alpha1</version>
<tag>8.0.0-alpha1</tag>
<status>published</status>
<release_link>http://example.com/semver_test-8-0-0-alpha1-release</release_link>
<download_link>http://example.com/semver_test-8-0-0-alpha1.tar.gz</download_link>
<date>1553091300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This fixture is used by \Drupal\Tests\package_manager\Build\PackageUpdateTest.
Contains metadata about the following (fake) releases of updated_module, all of which are secure, in order:
- 1.1.0
- 1.0.0
-->
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Updated Module</title>
<short_name>updated_module</short_name>
<dc:creator>Drupal</dc:creator>
<supported_branches>1.1.,1.0.</supported_branches>
<project_status>published</project_status>
<link>http://example.com/project/alpha</link>
<terms>
<term><name>Projects</name><value>Updated Module project</value></term>
</terms>
<releases>
<release>
<name>Updated Module 1.1.0</name>
<version>1.1.0</version>
<tag>1.1.0</tag>
<status>published</status>
<release_link>http://example.com/updated_module-1-1-0-release</release_link>
<download_link>http://example.com/updated_module-1-1-0.tar.gz</download_link>
<date>1584195300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Updated Module 1.0.0</name>
<version>1.0.0</version>
<tag>1.0.0</tag>
<status>published</status>
<release_link>http://example.com/updated_module-1-0-0-release</release_link>
<download_link>http://example.com/updated_module-1-0-0.tar.gz</download_link>
<date>1581603300</date>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>

View File

@ -0,0 +1,4 @@
name: 'Fixture manipulator'
description: 'Manipulate fixtures for tests.'
type: module
package: Testing

View File

@ -0,0 +1,7 @@
services:
_defaults:
autowire: true
Drupal\fixture_manipulator\StageFixtureManipulator:
decorates: 'PhpTuf\ComposerStager\API\Core\BeginnerInterface'
Drupal\fixture_manipulator\ProcessFactory:
decorates: 'PhpTuf\ComposerStager\API\Process\Factory\ProcessFactoryInterface'

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Drupal\fixture_manipulator;
use Drupal\package_manager\PathLocator;
/**
* A fixture manipulator for the active directory.
*/
final class ActiveFixtureManipulator extends FixtureManipulator {
/**
* {@inheritdoc}
*/
public function commitChanges(?string $dir = NULL, bool $validate_composer = FALSE): self {
if ($dir) {
throw new \UnexpectedValueException("$dir cannot be specific for a ActiveFixtureManipulator instance");
}
$dir = \Drupal::service(PathLocator::class)->getProjectRoot();
parent::doCommitChanges($dir);
return $this;
}
}

View File

@ -0,0 +1,676 @@
<?php
declare(strict_types=1);
namespace Drupal\fixture_manipulator;
use Drupal\Component\FileSystem\FileSystem;
use Drupal\Component\Utility\NestedArray;
use PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface;
use PhpTuf\ComposerStager\API\Process\Service\ComposerProcessRunnerInterface;
use PhpTuf\ComposerStager\API\Process\Value\OutputTypeEnum;
use Symfony\Component\Filesystem\Filesystem as SymfonyFileSystem;
use Drupal\Component\Serialization\Yaml;
/**
* Manipulates a test fixture using Composer commands.
*
* The composer.json file CANNOT be safely created or modified using the
* json_encode() function, because Composer does not use a real JSON parser — it
* updates composer.json using \Composer\Json\JsonManipulator, which is known to
* choke in a number of scenarios.
*
* @see https://www.drupal.org/i/3346628
*/
class FixtureManipulator {
protected const PATH_REPO_STATE_KEY = self::class . '-path-repo-base';
/**
* Whether changes are currently being committed.
*
* @var bool
*/
private bool $committingChanges = FALSE;
/**
* Arguments to manipulator functions.
*
* @var array
*/
private array $manipulatorArguments = [];
/**
* Whether changes have been committed.
*
* @var bool
*/
protected bool $committed = FALSE;
/**
* The fixture directory.
*
* @var string
*/
protected string $dir;
/**
* Validate the fixtures still passes `composer validate`.
*/
private function validateComposer(): void {
/** @var \PhpTuf\ComposerStager\API\Process\Service\ComposerProcessRunnerInterface $runner */
$runner = \Drupal::service(ComposerProcessRunnerInterface::class);
$runner->run([
'validate',
'--check-lock',
'--no-check-publish',
'--with-dependencies',
'--no-interaction',
'--ansi',
'--no-cache',
"--working-dir={$this->dir}",
// Unlike ComposerInspector::validate(), explicitly do NOT validate
// plugins, to allow for testing edge cases.
'--no-plugins',
// Dummy packages are not meant for publishing, so do not validate that.
'--no-check-publish',
'--no-check-version',
]);
}
/**
* Adds a package.
*
* @param array $package
* A Composer package definition. Must include the `name` and `type` keys.
* @param bool $is_dev_requirement
* Whether the package is a development requirement.
* @param bool $allow_plugins
* Whether to use the '--no-plugins' option.
* @param array|null $extra_files
* An array extra files to create in the package. The keys are the file
* paths under package and values are the file contents.
*/
public function addPackage(array $package, bool $is_dev_requirement = FALSE, bool $allow_plugins = FALSE, ?array $extra_files = NULL): self {
if (!$this->committingChanges) {
// To pass Composer validation all packages must have a version specified.
if (!isset($package['version'])) {
$package['version'] = '1.2.3';
}
$this->queueManipulation('addPackage', [$package, $is_dev_requirement, $allow_plugins, $extra_files]);
return $this;
}
// Basic validation so we can defer the rest to `composer` commands.
foreach (['name', 'type'] as $required_key) {
if (!isset($package[$required_key])) {
throw new \UnexpectedValueException("The '$required_key' is required when calling ::addPackage().");
}
}
if (!preg_match('/\w+\/\w+/', $package['name'])) {
throw new \UnexpectedValueException(sprintf("'%s' is not a valid package name.", $package['name']));
}
// `composer require` happily will re-require already required packages.
// Prevent test authors from thinking this has any effect when it does not.
$json = $this->runComposerCommand(['show', '--name-only', '--format=json'])->stdout;
$installed_package_names = array_column(json_decode($json)?->installed ?? [], 'name');
if (in_array($package['name'], $installed_package_names)) {
throw new \LogicException(sprintf("Expected package '%s' to not be installed, but it was.", $package['name']));
}
$repo_path = $this->addRepository($package);
if (is_null($extra_files) && isset($package['type'])
&& in_array($package['type'], ['drupal-module', 'drupal-theme', 'drupal-profile'], TRUE)) {
// For Drupal projects if no files are provided create an info.yml file
// that assumes the project and package names match.
[, $package_name] = explode('/', $package['name']);
$project_name = str_replace('-', '_', $package_name);
$project_info_data = [
'name' => $package['name'],
'project' => $project_name,
];
$extra_files["$project_name.info.yml"] = Yaml::encode($project_info_data);
}
if (!empty($extra_files)) {
$fs = new SymfonyFileSystem();
foreach ($extra_files as $file_name => $file_contents) {
if (str_contains($file_name, DIRECTORY_SEPARATOR)) {
$file_dir = dirname("$repo_path/$file_name");
if (!is_dir($file_dir)) {
$fs->mkdir($file_dir);
}
}
assert(file_put_contents("$repo_path/$file_name", $file_contents) !== FALSE);
}
}
return $this->requirePackage($package['name'], $package['version'], $is_dev_requirement, $allow_plugins);
}
/**
* Requires a package.
*
* @param string $package
* A package name.
* @param string $version
* A version constraint.
* @param bool $is_dev_requirement
* Whether the package is a development requirement.
* @param bool $allow_plugins
* Whether to use the '--no-plugins' option.
*/
public function requirePackage(string $package, string $version, bool $is_dev_requirement = FALSE, bool $allow_plugins = FALSE): self {
if (!$this->committingChanges) {
$this->queueManipulation('requirePackage', func_get_args());
return $this;
}
$command_options = ['require', "$package:$version"];
if ($is_dev_requirement) {
$command_options[] = '--dev';
}
// Unlike ComposerInspector::validate(), explicitly do NOT validate plugins.
if (!$allow_plugins) {
$command_options[] = '--no-plugins';
}
$this->runComposerCommand($command_options);
return $this;
}
/**
* Modifies a package's composer.json properties.
*
* @param string $package_name
* The name of the package to modify.
* @param string $version
* The version to use for the modified package. Can be the same as the
* original version, or a different version.
* @param array $config
* The config to be added to the package's composer.json.
* @param bool $is_dev_requirement
* Whether the package is a development requirement.
*
* @see \Composer\Command\ConfigCommand
*/
public function modifyPackageConfig(string $package_name, string $version, array $config, bool $is_dev_requirement = FALSE): self {
if (!$this->committingChanges) {
$this->queueManipulation('modifyPackageConfig', func_get_args());
return $this;
}
$package = [
'name' => $package_name,
'version' => $version,
] + $config;
$this->addRepository($package);
$this->runComposerCommand(array_filter(['require', "$package_name:$version", $is_dev_requirement ? '--dev' : NULL]));
return $this;
}
/**
* Sets a package version.
*
* @param string $package_name
* The package name.
* @param string $version
* The version.
* @param bool $is_dev_requirement
* Whether the package is a development requirement.
*
* @return $this
*/
public function setVersion(string $package_name, string $version, bool $is_dev_requirement = FALSE): self {
if (!$this->committingChanges) {
$this->queueManipulation('setVersion', func_get_args());
return $this;
}
return $this->modifyPackageConfig($package_name, $version, [], $is_dev_requirement);
}
/**
* Removes a package.
*
* @param string $name
* The name of the package to remove.
* @param bool $is_dev_requirement
* Whether the package is a developer requirement.
*/
public function removePackage(string $name, bool $is_dev_requirement = FALSE): self {
if (!$this->committingChanges) {
$this->queueManipulation('removePackage', func_get_args());
return $this;
}
$output = $this->runComposerCommand(array_filter(['remove', $name, $is_dev_requirement ? '--dev' : NULL]));
// `composer remove` will not set exit code 1 whenever a non-required
// package is being removed.
// @see \Composer\Command\RemoveCommand
if (str_contains($output->stderr, 'not required in your composer.json and has not been removed')) {
$output->stderr = str_replace("./composer.json has been updated\n", '', $output->stderr);
throw new \LogicException($output->stderr);
}
return $this;
}
/**
* Adds a project at a path.
*
* @param string $path
* The path.
* @param string|null $project_name
* (optional) The project name. If none is specified the last part of the
* path will be used.
* @param string|null $file_name
* (optional) The file name. If none is specified the project name will be
* used.
*/
public function addProjectAtPath(string $path, ?string $project_name = NULL, ?string $file_name = NULL): self {
if (!$this->committingChanges) {
$this->queueManipulation('addProjectAtPath', func_get_args());
return $this;
}
$path = $this->dir . "/$path";
if (file_exists($path)) {
throw new \LogicException("'$path' path already exists.");
}
$fs = new SymfonyFileSystem();
$fs->mkdir($path);
if ($project_name === NULL) {
$project_name = basename($path);
}
if ($file_name === NULL) {
$file_name = "$project_name.info.yml";
}
assert(file_put_contents("$path/$file_name", Yaml::encode(['project' => $project_name])) !== FALSE);
return $this;
}
/**
* Modifies core packages.
*
* @param string $version
* Target version.
*/
public function setCorePackageVersion(string $version): self {
$this->setVersion('drupal/core', $version);
$this->setVersion('drupal/core-recommended', $version);
$this->setVersion('drupal/core-dev', $version);
return $this;
}
/**
* Modifies the project root's composer.json properties.
*
* @param array $additional_config
* The configuration to add.
* @param bool $update_lock
* Whether to run composer update --lock. Defaults to FALSE.
*
* @see \Composer\Command\ConfigCommand
*/
public function addConfig(array $additional_config, bool $update_lock = FALSE): self {
if (empty($additional_config)) {
throw new \InvalidArgumentException('No config to add.');
}
if (!$this->committingChanges) {
$this->queueManipulation('addConfig', func_get_args());
return $this;
}
$clean_value = function ($value) {
return $value === FALSE ? 'false' : $value;
};
foreach ($additional_config as $key => $value) {
$command = ['config'];
if (is_array($value)) {
$value = json_encode($value, JSON_UNESCAPED_SLASHES);
$command[] = '--json';
}
else {
$value = $clean_value($value);
}
$command[] = $key;
$command[] = $value;
$this->runComposerCommand($command);
}
if ($update_lock) {
$this->runComposerCommand(['update', '--lock']);
}
return $this;
}
/**
* Commits the changes to the directory.
*
* @param string $dir
* The directory to commit the changes to.
*/
public function commitChanges(string $dir): self {
$this->doCommitChanges($dir);
$this->committed = TRUE;
return $this;
}
/**
* Commits all the changes.
*
* @param string $dir
* The directory to commit the changes to.
*/
final protected function doCommitChanges(string $dir): void {
if ($this->committed) {
throw new \BadMethodCallException('Already committed.');
}
$this->dir = $dir;
$this->setUpRepos();
$this->committingChanges = TRUE;
$manipulator_arguments = $this->getQueuedManipulationItems();
$this->clearQueuedManipulationItems();
foreach ($manipulator_arguments as $method => $argument_sets) {
// @todo Attempt to make fewer Composer calls in
// https://drupal.org/i/3345639.
foreach ($argument_sets as $argument_set) {
$this->{$method}(...$argument_set);
}
}
$this->committed = TRUE;
$this->committingChanges = FALSE;
}
public function updateLock(): self {
$this->runComposerCommand(['update', '--lock']);
return $this;
}
/**
* Ensure that changes were committed before object is destroyed.
*/
public function __destruct() {
if (!$this->committed && !empty($this->manipulatorArguments)) {
throw new \LogicException('commitChanges() must be called.');
}
}
/**
* Creates an empty .git folder after being provided a path.
*/
public function addDotGitFolder(string $path): self {
if (!$this->committingChanges) {
$this->queueManipulation('addDotGitFolder', func_get_args());
return $this;
}
if (!is_dir($path)) {
throw new \LogicException("No directory exists at $path.");
}
$fs = new SymfonyFileSystem();
$git_directory_path = $path . "/.git";
if (is_dir($git_directory_path)) {
throw new \LogicException("A .git directory already exists at $path.");
}
$fs->mkdir($git_directory_path);
return $this;
}
/**
* Queues manipulation arguments to be called in ::doCommitChanges().
*
* @param string $method
* The method name.
* @param array $arguments
* The arguments.
*/
protected function queueManipulation(string $method, array $arguments): void {
$this->manipulatorArguments[$method][] = $arguments;
}
/**
* Clears all queued manipulation items.
*/
protected function clearQueuedManipulationItems(): void {
$this->manipulatorArguments = [];
}
/**
* Gets all queued manipulation items.
*
* @return array
* The queued manipulation items as set by calls to ::queueManipulation().
*/
protected function getQueuedManipulationItems(): array {
return $this->manipulatorArguments;
}
protected function runComposerCommand(array $command_options): OutputCallbackInterface {
$plain_output = new class() implements OutputCallbackInterface {
/**
* The standard output for the process.
*/
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable, Drupal.Commenting.VariableComment.Missing
public string $stdout = '';
/**
* The error output for the process.
*/
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable, Drupal.Commenting.VariableComment.Missing
public string $stderr = '';
/**
* {@inheritdoc}
*/
public function __invoke(OutputTypeEnum $type, string $buffer): void {
if ($type === OutputTypeEnum::OUT) {
$this->stdout .= $buffer;
}
elseif ($type === OutputTypeEnum::ERR) {
$this->stderr .= $buffer;
}
}
/**
* {@inheritdoc}
*/
public function clearErrorOutput(): void {
throw new \LogicException("Unexpected call to clearErrorOutput().");
}
/**
* {@inheritdoc}
*/
public function clearOutput(): void {
throw new \LogicException("Unexpected call to clearOutput().");
}
/**
* {@inheritdoc}
*/
public function getErrorOutput(): array {
throw new \LogicException("Unexpected call to getErrorOutput().");
}
/**
* {@inheritdoc}
*/
public function getOutput(): array {
throw new \LogicException("Unexpected call to getOutput().");
}
};
/** @var \PhpTuf\ComposerStager\API\Process\Service\ComposerProcessRunnerInterface $runner */
$runner = \Drupal::service(ComposerProcessRunnerInterface::class);
$command_options[] = "--working-dir={$this->dir}";
$runner->run($command_options, callback: $plain_output);
return $plain_output;
}
/**
* Transform the received $package into options for `composer init`.
*
* @param array $package
* A Composer package definition. Must include the `name` and `type` keys.
*
* @return array
* The corresponding `composer init` options.
*/
private static function getComposerInitOptionsForPackage(array $package): array {
return array_filter(array_map(function ($k, $v) {
switch ($k) {
case 'name':
case 'description':
case 'type':
return "--$k=$v";
case 'require':
case 'require-dev':
if (empty($v)) {
return NULL;
}
$requirements = array_map(
fn(string $req_package, string $req_version): string => "$req_package:$req_version",
array_keys($v),
array_values($v)
);
return "--$k=" . implode(',', $requirements);
case 'version':
// This gets set in the repository metadata itself.
return NULL;
case 'extra':
// Cannot be set using `composer init`, only `composer config` can.
return NULL;
default:
throw new \InvalidArgumentException($k);
}
}, array_keys($package), array_values($package)));
}
/**
* Creates a path repo.
*
* @param array $package
* A Composer package definition. Must include the `name` and `type` keys.
* @param string $repo_path
* The path at which to create a path repo for this package.
* @param string|null $original_repo_path
* If NULL: this is the first version of this package. Otherwise: a string
* containing the path repo to the first version of this package. This will
* be used to automatically inherit the same files (typically *.info.yml).
*/
private function createPathRepo(array $package, string $repo_path, ?string $original_repo_path): void {
$fs = new SymfonyFileSystem();
if (is_dir($repo_path)) {
throw new \LogicException("A path repo already exists at $repo_path.");
}
// Create the repo if it does not exist.
$fs->mkdir($repo_path);
// Forks also get the original's additional files (e.g. *.info.yml files).
if ($original_repo_path) {
$fs->mirror($original_repo_path, $repo_path);
// composer.json will be freshly generated by `composer init` below.
$fs->remove($repo_path . '/composer.json');
}
// Switch the working directory from project root to repo path.
$project_root_dir = $this->dir;
$this->dir = $repo_path;
// Create a composer.json file using `composer init`.
$this->runComposerCommand(['init', ...static::getComposerInitOptionsForPackage($package)]);
// Set the `extra` property in the generated composer.json file using
// `composer config`, because `composer init` does not support it.
foreach ($package['extra'] ?? [] as $extra_property => $extra_value) {
$this->runComposerCommand([
'config',
"extra.$extra_property",
'--json',
json_encode($extra_value, JSON_UNESCAPED_SLASHES),
]);
}
// Restore the project root as the working directory.
$this->dir = $project_root_dir;
}
/**
* Adds a path repository.
*
* @param array $package
* A Composer package definition. Must include the `name` and `type` keys.
*
* @return string
* The repository path.
*/
private function addRepository(array $package): string {
$name = $package['name'];
$path_repo_base = \Drupal::state()->get(self::PATH_REPO_STATE_KEY);
$repo_path = "$path_repo_base/" . str_replace('/', '--', $name);
// Determine if the given $package is a new package or a fork of an existing
// one (that means it's either the same version but with other metadata, or
// a new version with other metadata). Existing path repos are never
// modified, not even if the same version of a package is assigned other
// metadata. This allows always comparing with the original metadata.
$is_new_or_fork = !is_dir($repo_path) ? 'new' : 'fork';
if ($is_new_or_fork === 'fork') {
$original_composer_json_path = $repo_path . DIRECTORY_SEPARATOR . 'composer.json';
$original_repo_path = $repo_path;
$original_composer_json_data = json_decode(file_get_contents($original_composer_json_path), TRUE, flags: JSON_THROW_ON_ERROR);
$forked_composer_json_data = NestedArray::mergeDeep($original_composer_json_data, $package);
if ($original_composer_json_data === $forked_composer_json_data) {
throw new \LogicException(sprintf('Nothing is actually different in this fork of the package %s.', $package['name']));
}
$package = $forked_composer_json_data;
$repo_path .= "--{$package['version']}";
// Cannot create multiple forks with the same version. This is likely
// due to a test simulating a failed Stage::apply().
if (!is_dir($repo_path)) {
$this->createPathRepo($package, $repo_path, $original_repo_path);
}
}
else {
$this->createPathRepo($package, $repo_path, NULL);
}
// Add the package to the Composer repository defined for the site.
$packages_json = $this->dir . '/packages.json';
$packages_data = file_get_contents($packages_json);
$packages_data = json_decode($packages_data, TRUE, flags: JSON_THROW_ON_ERROR);
$version = $package['version'];
$package['dist'] = [
'type' => 'path',
'url' => $repo_path,
];
$packages_data['packages'][$name][$version] = $package;
assert(file_put_contents($packages_json, json_encode($packages_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) !== FALSE);
return $repo_path;
}
/**
* Sets up the path repos at absolute paths.
*
* @param bool $composer_refresh
* Whether to run composer update --lock && composer install. Defaults to
* FALSE.
*/
public function setUpRepos($composer_refresh = FALSE): void {
$fs = new SymfonyFileSystem();
$path_repo_base = \Drupal::state()->get(self::PATH_REPO_STATE_KEY);
if (empty($path_repo_base)) {
$path_repo_base = FileSystem::getOsTemporaryDirectory() . '/base-repo-' . microtime(TRUE) . rand(0, 10000);
\Drupal::state()->set(self::PATH_REPO_STATE_KEY, $path_repo_base);
// Copy the existing repos that were used to make the fixtures into the
// new folder.
$fs->mirror(__DIR__ . '/../../../fixtures/path_repos', $path_repo_base);
}
// Update all the repos in the composer.json file to point to the new
// repos at the absolute path.
$composer_json = file_get_contents($this->dir . '/packages.json');
assert(file_put_contents($this->dir . '/packages.json', str_replace('../path_repos/', "$path_repo_base/", $composer_json)) !== FALSE);
if ($composer_refresh) {
$this->runComposerCommand(['update', '--lock']);
$this->runComposerCommand(['install']);
}
}
}

View File

@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Drupal\fixture_manipulator;
use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
use PhpTuf\ComposerStager\API\Process\Factory\ProcessFactoryInterface;
use PhpTuf\ComposerStager\API\Process\Service\ProcessInterface;
/**
* Process factory that always sets the COMPOSER_MIRROR_PATH_REPOS env variable.
*
* This is necessary because the fake_site fixture is built from a Composer-type
* repository, which will normally try to symlink packages which are installed
* from local directories, which in turn will break Package Manager because it
* does not support symlinks pointing outside the main code base. The
* COMPOSER_MIRROR_PATH_REPOS environment variable forces Composer to mirror,
* rather than symlink, local directories when installing packages.
*
* @see \Drupal\fixture_manipulator\FixtureManipulator::setUpRepos()
*/
final class ProcessFactory implements ProcessFactoryInterface {
/**
* Constructs a ProcessFactory object.
*
* @param \PhpTuf\ComposerStager\API\Process\Factory\ProcessFactoryInterface $decorated
* The decorated process factory service.
*/
public function __construct(private readonly ProcessFactoryInterface $decorated) {}
/**
* {@inheritdoc}
*/
public function create(array $command, ?PathInterface $cwd = NULL, array $env = []): ProcessInterface {
$process = $this->decorated->create($command, $cwd, $env);
$env = $process->getEnv();
$env['COMPOSER_MIRROR_PATH_REPOS'] = '1';
$process->setEnv($env);
return $process;
}
}

View File

@ -0,0 +1,109 @@
<?php
declare(strict_types=1);
namespace Drupal\fixture_manipulator;
use Drupal\Core\State\StateInterface;
use PhpTuf\ComposerStager\API\Core\BeginnerInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathListInterface;
use PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface;
use PhpTuf\ComposerStager\API\Process\Service\ProcessInterface;
/**
* A fixture manipulator service that commits changes after begin.
*/
final class StageFixtureManipulator extends FixtureManipulator implements BeginnerInterface {
/**
* The state key to use.
*/
private const STATE_KEY = __CLASS__ . 'MANIPULATOR_ARGUMENTS';
/**
* The state service.
*
* @var \Drupal\Core\State\StateInterface
*/
private StateInterface $state;
/**
* The decorated service.
*
* @var \PhpTuf\ComposerStager\API\Core\BeginnerInterface
*/
private BeginnerInterface $inner;
/**
* Constructions a StageFixtureManipulator object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param \PhpTuf\ComposerStager\API\Core\BeginnerInterface $inner
* The decorated beginner service.
*/
public function __construct(StateInterface $state, BeginnerInterface $inner) {
$this->state = $state;
$this->inner = $inner;
}
/**
* {@inheritdoc}
*/
public function begin(PathInterface $activeDir, PathInterface $stagingDir, ?PathListInterface $exclusions = NULL, ?OutputCallbackInterface $callback = NULL, ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT): void {
$this->inner->begin($activeDir, $stagingDir, $exclusions, $callback, $timeout);
if ($this->getQueuedManipulationItems()) {
$this->doCommitChanges($stagingDir->absolute());
}
}
/**
* {@inheritdoc}
*/
public function commitChanges(string $dir, bool $validate_composer = FALSE): self {
throw new \BadMethodCallException('::commitChanges() should not be called directly in StageFixtureManipulator().');
}
/**
* {@inheritdoc}
*/
public function __destruct() {
// Overrides `__destruct` because the staged fixture manipulator service
// will be destroyed after every request.
// @see \Drupal\fixture_manipulator\StageFixtureManipulator::handleTearDown()
}
/**
* Handles test tear down to ensure all changes were committed.
*/
public static function handleTearDown(): void {
if (!empty(\Drupal::state()->get(self::STATE_KEY))) {
throw new \LogicException('The StageFixtureManipulator has arguments that were not cleared. This likely means that the PostCreateEvent was never fired.');
}
}
/**
* {@inheritdoc}
*/
protected function queueManipulation(string $method, array $arguments): void {
$stored_arguments = $this->getQueuedManipulationItems();
$stored_arguments[$method][] = $arguments;
$this->state->set(self::STATE_KEY, $stored_arguments);
}
/**
* {@inheritdoc}
*/
protected function clearQueuedManipulationItems(): void {
$this->state->delete(self::STATE_KEY);
}
/**
* {@inheritdoc}
*/
protected function getQueuedManipulationItems(): array {
return $this->state->get(self::STATE_KEY, []);
}
}

View File

@ -0,0 +1,7 @@
name: 'Package Manager Bypass'
description: 'Mocks PathLocator service, decorates Beginner & Committer services (adds logging) and by default bypasses the Stager service (to minimize I/O during tests).'
type: module
package: Testing
dependencies:
- auto_updates:package_manager
- auto_updates:fixture_manipulator

View File

@ -0,0 +1,7 @@
services:
_defaults:
autowire: true
Drupal\package_manager_bypass\LoggingBeginner:
decorates: 'PhpTuf\ComposerStager\API\Core\BeginnerInterface'
Drupal\package_manager_bypass\LoggingCommitter:
decorates: 'PhpTuf\ComposerStager\API\Core\CommitterInterface'

View File

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
/**
* Trait to make Composer Stager throw pre-determined exceptions in tests.
*
* @internal
*/
trait ComposerStagerExceptionTrait {
/**
* Sets an exception to be thrown.
*
* @param string|null $class
* The class of exception to throw, or NULL to delete a stored exception.
* @param mixed ...$arguments
* Arguments to pass to the exception constructor.
*/
public static function setException(?string $class = \Exception::class, mixed ...$arguments): void {
if ($class) {
\Drupal::state()->set(static::class . '-exception', func_get_args());
}
else {
\Drupal::state()->delete(static::class . '-exception');
}
}
/**
* Throws the exception if set.
*/
private function throwExceptionIfSet(): void {
if ($exception = $this->state->get(static::class . '-exception')) {
$class = array_shift($exception);
throw new $class(...$exception);
}
}
}

View File

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
use Drupal\Core\State\StateInterface;
use PhpTuf\ComposerStager\API\Core\BeginnerInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathListInterface;
use PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface;
use PhpTuf\ComposerStager\API\Process\Service\ProcessInterface;
/**
* A composer-stager Beginner decorator that adds logging.
*
* @internal
*/
final class LoggingBeginner implements BeginnerInterface {
use ComposerStagerExceptionTrait;
use LoggingDecoratorTrait;
/**
* The decorated service.
*
* @var \PhpTuf\ComposerStager\API\Core\BeginnerInterface
*/
private $inner;
/**
* Constructs a Beginner object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param \PhpTuf\ComposerStager\API\Core\BeginnerInterface $inner
* The decorated beginner service.
*/
public function __construct(StateInterface $state, BeginnerInterface $inner) {
$this->state = $state;
$this->inner = $inner;
}
/**
* {@inheritdoc}
*/
public function begin(PathInterface $activeDir, PathInterface $stagingDir, ?PathListInterface $exclusions = NULL, ?OutputCallbackInterface $callback = NULL, ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT): void {
$this->saveInvocationArguments($activeDir, $stagingDir, $exclusions?->getAll(), $timeout);
$this->throwExceptionIfSet();
$this->inner->begin($activeDir, $stagingDir, $exclusions, $callback, $timeout);
}
}

View File

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
use Drupal\Core\State\StateInterface;
use PhpTuf\ComposerStager\API\Core\CommitterInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathListInterface;
use PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface;
use PhpTuf\ComposerStager\API\Process\Service\ProcessInterface;
/**
* A composer-stager Committer decorator that adds logging.
*
* @internal
*/
final class LoggingCommitter implements CommitterInterface {
use ComposerStagerExceptionTrait;
use LoggingDecoratorTrait;
/**
* The decorated service.
*
* @var \PhpTuf\ComposerStager\API\Core\CommitterInterface
*/
private $inner;
/**
* Constructs a Committer object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param \PhpTuf\ComposerStager\API\Core\CommitterInterface $inner
* The decorated committer service.
*/
public function __construct(StateInterface $state, CommitterInterface $inner) {
$this->state = $state;
$this->inner = $inner;
}
/**
* {@inheritdoc}
*/
public function commit(PathInterface $stagingDir, PathInterface $activeDir, ?PathListInterface $exclusions = NULL, ?OutputCallbackInterface $callback = NULL, ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT): void {
$this->saveInvocationArguments($stagingDir, $activeDir, $exclusions?->getAll(), $timeout);
$this->throwExceptionIfSet();
$this->inner->commit($stagingDir, $activeDir, $exclusions, $callback, $timeout);
}
}

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
/**
* Records information about method invocations.
*
* This can be used by functional tests to ensure that the bypassed Composer
* Stager services were called as expected. Kernel and unit tests should use
* regular mocks instead.
*
* @internal
*/
trait LoggingDecoratorTrait {
/**
* The state service.
*
* @var \Drupal\Core\State\StateInterface
*/
private $state;
/**
* Returns the arguments from every invocation of the main class method.
*
* @return mixed[]
* The arguments from every invocation of the main class method.
*/
public function getInvocationArguments(): array {
return $this->state->get(static::class . ' arguments', []);
}
/**
* Records the arguments from an invocation of the main class method.
*
* @param mixed ...$arguments
* The arguments that the main class method was called with.
*/
private function saveInvocationArguments(...$arguments): void {
$invocations = $this->getInvocationArguments();
$invocations[] = $arguments;
$this->state->set(static::class . ' arguments', $invocations);
}
}

View File

@ -0,0 +1,97 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
use Drupal\Core\State\StateInterface;
use Drupal\package_manager\PathLocator as BasePathLocator;
use Symfony\Component\Filesystem\Path;
/**
* Mock path locator: allows specifying paths instead of discovering paths.
*
* @internal
*/
final class MockPathLocator extends BasePathLocator {
/**
* The state service.
*
* @var \Drupal\Core\State\StateInterface
*/
private $state;
/**
* Constructs a PathLocator object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param mixed ...$arguments
* Additional arguments to pass to the parent constructor.
*/
public function __construct(StateInterface $state, ...$arguments) {
parent::__construct(...$arguments);
$this->state = $state;
}
/**
* {@inheritdoc}
*/
public function getProjectRoot(): string {
$project_root = $this->state->get(static::class . ' root');
if ($project_root === NULL) {
$project_root = $this->getVendorDirectory() . DIRECTORY_SEPARATOR . '..';
$project_root = realpath($project_root);
}
return $project_root;
}
/**
* {@inheritdoc}
*/
public function getVendorDirectory(): string {
return $this->state->get(static::class . ' vendor', parent::getVendorDirectory());
}
/**
* {@inheritdoc}
*/
public function getWebRoot(): string {
return $this->state->get(static::class . ' web', parent::getWebRoot());
}
/**
* {@inheritdoc}
*/
public function getStagingRoot(): string {
return $this->state->get(static::class . ' stage', parent::getStagingRoot());
}
/**
* Sets the paths to return.
*
* @param string|null $project_root
* The project root, or NULL to defer to the parent class.
* @param string|null $vendor_dir
* The vendor directory, or NULL to defer to the parent class.
* @param string|null $web_root
* The web root, relative to the project root, or NULL to defer to the
* parent class.
* @param string|null $staging_root
* The absolute path of the stage root directory, or NULL to defer to the
* parent class.
*/
public function setPaths(?string $project_root, ?string $vendor_dir, ?string $web_root, ?string $staging_root): void {
foreach ([$project_root, $staging_root] as $path) {
if (!empty($path) && !Path::isAbsolute($path)) {
throw new \InvalidArgumentException('project_root and staging_root need to be absolute paths.');
}
}
$this->state->set(static::class . ' root', is_null($project_root) ? NULL : realpath($project_root));
$this->state->set(static::class . ' vendor', is_null($vendor_dir) ? NULL : realpath($vendor_dir));
$this->state->set(static::class . ' web', is_null($web_root) ? NULL : Path::canonicalize($web_root));
$this->state->set(static::class . ' stage', is_null($staging_root) ? NULL : realpath($staging_root));
}
}

View File

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
use Composer\Json\JsonFile;
use Drupal\Core\State\StateInterface;
use PhpTuf\ComposerStager\API\Core\StagerInterface;
use PhpTuf\ComposerStager\API\Path\Value\PathInterface;
use PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface;
use PhpTuf\ComposerStager\API\Process\Service\ProcessInterface;
/**
* A composer-stager Stager implementation that does nothing, except logging.
*
* By default, it will modify composer.lock in the stage directory, to fool the
* \Drupal\package_manager\Validator\LockFileValidator into thinking that there
* are pending composer operations.
*
* Opt out of this by calling @code setLockFileShouldChange(FALSE) @endcode.
*
* @see ::setLockFileShouldChange()
* @see \Drupal\package_manager\Validator\LockFileValidator
*
* @internal
*/
final class NoOpStager implements StagerInterface {
use ComposerStagerExceptionTrait;
use LoggingDecoratorTrait;
/**
* Constructs a Stager object.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
*/
public function __construct(StateInterface $state) {
$this->state = $state;
}
/**
* {@inheritdoc}
*/
public function stage(array $composerCommand, PathInterface $activeDir, PathInterface $stagingDir, ?OutputCallbackInterface $callback = NULL, ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT): void {
$this->saveInvocationArguments($composerCommand, $stagingDir, $timeout);
$this->throwExceptionIfSet();
// If desired, simulate a change to the lock file (e.g., as a result of
// running `composer update`).
$lockFile = new JsonFile($stagingDir->absolute() . '/composer.lock');
$changeLockFile = $this->state->get(static::class . ' lock', TRUE);
if ($changeLockFile && $lockFile->exists()) {
$data = $lockFile->read();
$data['_time'] = microtime();
$lockFile->write($data);
}
}
/**
* Sets whether ::stage() should simulate a change in the lock file.
*
* @param bool $value
* (optional) Whether to simulate a change in the lock file when
* ::stage() is called. Defaults to TRUE.
*/
public static function setLockFileShouldChange(bool $value = TRUE): void {
\Drupal::state()->set(static::class . ' lock', $value);
}
}

View File

@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_bypass;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Drupal\Core\Site\Settings;
use Drupal\package_manager\PathLocator;
use PhpTuf\ComposerStager\API\Core\StagerInterface;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
/**
* Defines services to bypass Package Manager's core functionality.
*
* @internal
*/
final class PackageManagerBypassServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container): void {
parent::alter($container);
// By default, \Drupal\package_manager_bypass\NoOpStager is applied, except
// when a test opts out by setting this setting to FALSE.
// @see \Drupal\package_manager_bypass\NoOpStager::setLockFileShouldChange()
if (Settings::get('package_manager_bypass_composer_stager', TRUE)) {
$container->register(NoOpStager::class)
->setClass(NoOpStager::class)
->setPublic(FALSE)
->setAutowired(TRUE)
->setDecoratedService(StagerInterface::class);
}
$container->getDefinition(PathLocator::class)
->setClass(MockPathLocator::class)
->setAutowired(FALSE)
->setArguments([
new Reference('state'),
new Parameter('app.root'),
new Reference('config.factory'),
new Reference('file_system'),
]);
}
}

View File

@ -0,0 +1,6 @@
name: 'Package Manager Test API'
description: 'Provides API endpoints for doing stage operations in functional tests.'
type: module
package: Testing
dependencies:
- auto_updates:package_manager

View File

@ -0,0 +1,21 @@
package_manager_test_api:
path: '/package-manager-test-api'
defaults:
_controller: 'Drupal\package_manager_test_api\ApiController::run'
requirements:
_access: 'TRUE'
package_manager_test_api.finish:
path: '/package-manager-test-api/finish/{id}'
defaults:
_controller: 'Drupal\package_manager_test_api\ApiController::finish'
requirements:
_access: 'TRUE'
package_manager_test_api.check_setup:
path: '/package-manager-test-api/check-setup'
defaults:
_controller: 'Drupal\package_manager_test_api\ApiController::checkSetup'
requirements:
_access: 'TRUE'
options:
_maintenance_access: TRUE
no_cache: TRUE

View File

@ -0,0 +1,154 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_test_api;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Queue\QueueFactory;
use Drupal\Core\Url;
use Drupal\package_manager\Attribute\AllowDirectWrite;
use Drupal\package_manager\FailureMarker;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\SandboxManagerBase;
use PhpTuf\ComposerStager\API\Core\BeginnerInterface;
use PhpTuf\ComposerStager\API\Core\CommitterInterface;
use PhpTuf\ComposerStager\API\Core\StagerInterface;
use PhpTuf\ComposerStager\API\Path\Factory\PathFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Provides API endpoints to interact with a stage directory in functional test.
*/
class ApiController extends ControllerBase {
/**
* The route to redirect to after the stage has been applied.
*
* @var string
*/
protected $finishedRoute = 'package_manager_test_api.finish';
public function __construct(protected SandboxManagerBase $stage) {
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$stage = new ControllerSandboxManager(
$container->get(PathLocator::class),
$container->get(BeginnerInterface::class),
$container->get(StagerInterface::class),
$container->get(CommitterInterface::class),
$container->get(QueueFactory::class),
$container->get('event_dispatcher'),
$container->get('tempstore.shared'),
$container->get('datetime.time'),
$container->get(PathFactoryInterface::class),
$container->get(FailureMarker::class),
);
return new static($stage);
}
/**
* Begins a stage life cycle.
*
* Creates a stage directory, requires packages into it, applies changes to
* the active directory.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request. The runtime and dev dependencies are expected to be in
* either the query string or request body, under the 'runtime' and 'dev'
* keys, respectively.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* A response that directs to the ::finish() method.
*
* @see ::finish()
*/
public function run(Request $request): RedirectResponse {
$id = $this->createAndApplyStage($request);
$redirect_url = Url::fromRoute($this->finishedRoute)
->setRouteParameter('id', $id)
->setAbsolute()
->toString();
return new RedirectResponse($redirect_url);
}
/**
* Performs post-apply tasks and destroys the stage.
*
* @param string $id
* The stage ID.
*
* @return \Symfony\Component\HttpFoundation\Response
* The response.
*/
public function finish(string $id): Response {
$this->stage->claim($id)->postApply();
$this->stage->destroy();
return new Response('Finished');
}
/**
* Creates a stage, requires packages into it, and applies the changes.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request. The runtime and dev dependencies are expected to be in
* either the query string or request body, under the 'runtime' and 'dev'
* keys, respectively.
*
* @return string
* Unique ID for the stage, which can be used to claim the stage before
* performing other operations on it. Calling code should store this ID for
* as long as the stage needs to exist.
*/
protected function createAndApplyStage(Request $request) : string {
$id = $this->stage->create();
$this->stage->require(
$request->get('runtime', []),
$request->get('dev', [])
);
$this->stage->apply();
return $id;
}
/**
* Returns the information about current PHP server used for build tests.
*
* @return \Symfony\Component\HttpFoundation\Response
* The response.
*/
public function checkSetup(): Response {
return new Response(
'max_execution_time=' . ini_get('max_execution_time') .
':set_time_limit-exists=' . (function_exists('set_time_limit') ? 'yes' : 'no')
);
}
}
/**
* Non-abstract version of StageBase.
*
* This is needed because we cannot instantiate StageBase as it's abstract, and
* we also can't use anonymous class because the name of anonymous class is
* always unique for every request which will create problem while claiming the
* stage as the stored lock will be different from current lock.
*
* @see \Drupal\package_manager\SandboxManagerBase::claim()
*/
#[AllowDirectWrite]
final class ControllerSandboxManager extends SandboxManagerBase {
/**
* {@inheritdoc}
*/
protected string $type = 'package_manager_test_api:controller';
}

View File

@ -0,0 +1,6 @@
name: 'Package Manager Test Event Logger'
description: 'Provides an event subscriber to test logging during events in Package Manager'
type: module
package: Testing
dependencies:
- auto_updates:package_manager

View File

@ -0,0 +1,5 @@
services:
package_manager_test_event_logger.subscriber:
class: Drupal\package_manager_test_event_logger\EventSubscriber\EventLogSubscriber
tags:
- { name: event_subscriber }

View File

@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_test_event_logger\EventSubscriber;
use Drupal\package_manager\Event\CollectPathsToExcludeEvent;
use Drupal\package_manager\Event\PostApplyEvent;
use Drupal\package_manager\Event\PostCreateEvent;
use Drupal\package_manager\Event\PostRequireEvent;
use Drupal\package_manager\Event\PreApplyEvent;
use Drupal\package_manager\Event\PreCreateEvent;
use Drupal\package_manager\Event\PreRequireEvent;
use Drupal\package_manager\Event\SandboxEvent;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Defines an event subscriber to test logging during events in Package Manager.
*/
final class EventLogSubscriber implements EventSubscriberInterface {
/**
* The name of the log file to write to.
*
* @var string
*/
public const LOG_FILE_NAME = 'package_manager_test_event.log';
/**
* Excludes the log file from Package Manager operations.
*
* @param \Drupal\package_manager\Event\CollectPathsToExcludeEvent $event
* The event being handled.
*/
public function excludeLogFile(CollectPathsToExcludeEvent $event): void {
$event->addPathsRelativeToProjectRoot([self::LOG_FILE_NAME]);
}
/**
* Logs all events in the stage life cycle.
*
* @param \Drupal\package_manager\Event\SandboxEvent $event
* The event object.
*/
public function logEventInfo(SandboxEvent $event): void {
$log_file = \Drupal::service(PathLocator::class)->getProjectRoot() . '/' . self::LOG_FILE_NAME;
if (file_exists($log_file)) {
$log_data = file_get_contents($log_file);
$log_data = json_decode($log_data, TRUE, flags: JSON_THROW_ON_ERROR);
}
else {
$log_data = [];
}
$log_data[] = [
'event' => $event::class,
'stage' => $event->sandboxManager::class,
];
file_put_contents($log_file, json_encode($log_data, JSON_UNESCAPED_SLASHES));
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array {
// This subscriber should run before every other validator, because the
// purpose of this subscriber is to log all dispatched events.
// @see \Drupal\package_manager\Validator\BaseRequirementsFulfilledValidator
// @see \Drupal\package_manager\Validator\BaseRequirementValidatorTrait
// @see \Drupal\package_manager\Validator\EnvironmentSupportValidator
return [
CollectPathsToExcludeEvent::class => ['excludeLogFile'],
PreCreateEvent::class => ['logEventInfo', PHP_INT_MAX],
PostCreateEvent::class => ['logEventInfo', PHP_INT_MAX],
PreRequireEvent::class => ['logEventInfo', PHP_INT_MAX],
PostRequireEvent::class => ['logEventInfo', PHP_INT_MAX],
PreApplyEvent::class => ['logEventInfo', PHP_INT_MAX],
PostApplyEvent::class => ['logEventInfo', PHP_INT_MAX],
];
}
}

View File

@ -0,0 +1,7 @@
name: 'Package Manager Test Release history'
type: module
description: 'Provides a mechanism for serving fake release history metadata in functional tests.'
package: Testing
dependencies:
- drupal:update
- drupal:update_test

View File

@ -0,0 +1,9 @@
package_manager_test_release_history.metadata:
path: '/test-release-history/{project_name}/{version}'
defaults:
_title: 'Update test'
_controller: '\Drupal\package_manager_test_release_history\TestController::metadata'
requirements:
_access: 'TRUE'
options:
_maintenance_access: TRUE

View File

@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Drupal\package_manager_test_release_history;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
/**
* Controller for generating mock XML metadata for package manager testing.
*/
class TestController extends ControllerBase {
/**
* Page callback: Prints mock XML for the Update Status module.
*
* @todo This is a wholesale copy of
* \Drupal\update_test\Controller\UpdateTestController::updateTest() for
* testing package_manager. This was done in order to use a different
* directory of mock XML files. Remove this module in
* https://drupal.org/i/3274826.
*/
public function metadata($project_name = 'drupal', $version = NULL): Response {
$xml_map = $this->config('update_test.settings')->get('xml_map');
if (isset($xml_map[$project_name])) {
$file = $xml_map[$project_name];
}
elseif (isset($xml_map['#all'])) {
$file = $xml_map['#all'];
}
else {
// The test didn't specify, for example, the webroot has other modules and
// themes installed but they're disabled by the version of the site
// running the test. So, we default to a file we know won't exist, so at
// least we'll get an empty xml response instead of a bunch of Drupal page
// output.
$file = '#broken#';
}
$headers = ['Content-Type' => 'text/xml; charset=utf-8'];
if (!is_file($file)) {
// Return an empty response.
return new Response('', 200, $headers);
}
return new BinaryFileResponse($file, 200, $headers);
}
}

View File

@ -0,0 +1,4 @@
name: 'Package Manager Test Update'
description: 'A module to test updates'
type: module
package: Testing

View File

@ -0,0 +1,6 @@
name: 'Package Manager Validation Test'
description: 'Provides an event subscriber to test Package Manager validation.'
type: module
package: Testing
dependencies:
- auto_updates:package_manager

Some files were not shown because too many files have changed in this diff Show More