1
0
Fork 0

Add test deficiencies in installed versions as the runtime autoloaders are not prepended and do not grant access to the latest data

pull/9696/head
Jordi Boggiano 2021-02-12 11:12:42 +01:00
parent d3ba447b79
commit 27d0c5c3ef
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
9 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,39 @@
--RUN--
update
--EXPECT--
> Hooks::preUpdate
!!PreUpdate:["composer/ca-bundle","composer/composer","composer/semver","composer/spdx-licenses","composer/xdebug-handler","justinrainbow/json-schema","psr/log","react/promise","seld/jsonlint","seld/phar-utils","symfony/console","symfony/debug","symfony/filesystem","symfony/finder","symfony/polyfill-ctype","symfony/polyfill-mbstring","symfony/process"]
!!Versions:console:%[2-8]\.\d+\.\d+.0%;process:%[2-8]\.\d+\.\d+.0%;filesystem:%[2-8]\.\d+\.\d+.0%
Loading composer repositories with package information
Updating dependencies
Lock file operations: 6 installs, 0 updates, 0 removals
- Locking plugin/a (1.1.1)
- Locking plugin/b (2.2.2)
- Locking symfony/console (99999.1.2)
- Locking symfony/filesystem (%v?[2-8]\.\d+\.\d+%)
- Locking symfony/polyfill-ctype (%v?[1-8]\.\d+\.\d+%)
- Locking symfony/process (12345.1.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
- Downloading symfony/polyfill-ctype (%v?[1-8]\.\d+\.\d+%)
- Downloading symfony/filesystem (%v?[2-8]\.\d+\.\d+%)
- Installing symfony/console (99999.1.2): Symlinking from symfony-console
- Installing plugin/a (1.1.1): Symlinking from plugin-a
!!PluginA:1.1.1.0["root/pkg","symfony/console","composer/ca-bundle","composer/composer","composer/semver","composer/spdx-licenses","composer/xdebug-handler","justinrainbow/json-schema","psr/log","react/promise","seld/jsonlint","seld/phar-utils","symfony/debug","symfony/filesystem","symfony/finder","symfony/polyfill-ctype","symfony/polyfill-mbstring","symfony/process","plugin/a"]
!!Versions:console:99999.1.2.0;process:%[2-8]\.\d+\.\d+.0%;filesystem:%[2-8]\.\d+\.\d+.0%
- Installing plugin/b (2.2.2): Symlinking from plugin-b
!!PluginB:2.2.2.0["plugin/a","root/pkg","symfony/console","composer/ca-bundle","composer/composer","composer/semver","composer/spdx-licenses","composer/xdebug-handler","justinrainbow/json-schema","psr/log","react/promise","seld/jsonlint","seld/phar-utils","symfony/debug","symfony/filesystem","symfony/finder","symfony/polyfill-ctype","symfony/polyfill-mbstring","symfony/process","plugin/b"]
!!Versions:console:99999.1.2.0;process:%[2-8]\.\d+\.\d+.0%;filesystem:%[2-8]\.\d+\.\d+.0%
- Installing symfony/polyfill-ctype (%v?[1-8]\.\d+\.\d+%): Extracting archive
- Installing symfony/filesystem (%v?[2-8]\.\d+\.\d+%): Extracting archive
- Installing symfony/process (12345.1.2): Symlinking from symfony-process
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> Hooks::postUpdate
!!PostUpdate:["plugin/a","plugin/b","root/pkg","symfony/console","symfony/filesystem","symfony/polyfill-ctype","symfony/process","composer/ca-bundle","composer/composer","composer/semver","composer/spdx-licenses","composer/xdebug-handler","justinrainbow/json-schema","psr/log","react/promise","seld/jsonlint","seld/phar-utils","symfony/debug","symfony/finder","symfony/polyfill-mbstring"]
!!Versions:console:99999.1.2.0;process:12345.1.2.0;filesystem:%[2-8]\.\d+\.\d+.0%
--EXPECT-EXIT-CODE--
0

View File

@ -0,0 +1,20 @@
<?php
use Composer\Json\JsonFile;
use Composer\InstalledVersions;
use Composer\Script\Event;
class Hooks
{
public static function preUpdate(Event $event)
{
echo '!!PreUpdate:'.JsonFile::encode(InstalledVersions::getInstalledPackages(), 320)."\n";
echo '!!Versions:console:'.InstalledVersions::getVersion('symfony/console').';process:'.InstalledVersions::getVersion('symfony/process').';filesystem:'.InstalledVersions::getVersion('symfony/filesystem')."\n";
}
public static function postUpdate(Event $event)
{
echo '!!PostUpdate:'.JsonFile::encode(InstalledVersions::getInstalledPackages(), 320)."\n";
echo '!!Versions:console:'.InstalledVersions::getVersion('symfony/console').';process:'.InstalledVersions::getVersion('symfony/process').';filesystem:'.InstalledVersions::getVersion('symfony/filesystem')."\n";
}
}

View File

@ -0,0 +1,21 @@
{
"name": "root/pkg",
"version": "1.2.3",
"require": {
"plugin/a": "*",
"plugin/b": "*",
"symfony/process": "*",
"symfony/filesystem": "*"
},
"repositories": [
{"type": "path", "url": "plugin-*"},
{"type": "path", "url": "symfony-*"}
],
"scripts": {
"pre-update-cmd": "Hooks::preUpdate",
"post-update-cmd": "Hooks::postUpdate"
},
"autoload": {
"classmap": ["Hooks.php"]
}
}

View File

@ -0,0 +1,24 @@
<?php
use Composer\Plugin\PluginInterface;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\InstalledVersions;
class PluginA implements PluginInterface
{
public function activate(Composer $composer, IOInterface $io)
{
echo '!!PluginA:'.InstalledVersions::getVersion('plugin/a').JsonFile::encode(InstalledVersions::getInstalledPackages(), 320)."\n";
echo '!!Versions:console:'.InstalledVersions::getVersion('symfony/console').';process:'.InstalledVersions::getVersion('symfony/process').';filesystem:'.InstalledVersions::getVersion('symfony/filesystem')."\n";
}
public function deactivate(Composer $composer, IOInterface $io)
{
}
public function uninstall(Composer $composer, IOInterface $io)
{
}
}

View File

@ -0,0 +1,15 @@
{
"name": "plugin/a",
"version": "1.1.1",
"require": {
"symfony/console": "*",
"composer-plugin-api": "^2"
},
"autoload": {
"classmap": ["PluginA.php"]
},
"type": "composer-plugin",
"extra": {
"class": "PluginA"
}
}

View File

@ -0,0 +1,24 @@
<?php
use Composer\Plugin\PluginInterface;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\InstalledVersions;
class PluginB implements PluginInterface
{
public function activate(Composer $composer, IOInterface $io)
{
echo '!!PluginB:'.InstalledVersions::getVersion('plugin/b').JsonFile::encode(InstalledVersions::getInstalledPackages(), 320)."\n";
echo '!!Versions:console:'.InstalledVersions::getVersion('symfony/console').';process:'.InstalledVersions::getVersion('symfony/process').';filesystem:'.InstalledVersions::getVersion('symfony/filesystem')."\n";
}
public function deactivate(Composer $composer, IOInterface $io)
{
}
public function uninstall(Composer $composer, IOInterface $io)
{
}
}

View File

@ -0,0 +1,15 @@
{
"name": "plugin/b",
"version": "2.2.2",
"require": {
"plugin/a": "*",
"composer-plugin-api": "^2"
},
"autoload": {
"classmap": ["PluginB.php"]
},
"type": "composer-plugin",
"extra": {
"class": "PluginB"
}
}

View File

@ -0,0 +1,4 @@
{
"name": "symfony/console",
"version": "99999.1.2"
}

View File

@ -0,0 +1,4 @@
{
"name": "symfony/process",
"version": "12345.1.2"
}