Fix E2E Tests (#31205)
* Removed Changlogger Autoload * Changed Jetpack Changelogger Formatter Loading Rather than using the Composer autoload, we should use the changelogger's "filename" option to point directly at the file. This keeps the file out of the autoloads, since it's possible that plugins or packages may be symlinked and break the relative path to the plugin.
This commit is contained in:
parent
0df6cc108d
commit
c91dda177d
|
@ -10,7 +10,7 @@
|
|||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"class": "PackageFormatter"
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": [
|
||||
"Fix",
|
||||
|
@ -23,10 +23,5 @@
|
|||
],
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"../../../tools/changelogger/PackageFormatter.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"class": "PackageFormatter"
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": [
|
||||
"Fix",
|
||||
|
@ -23,10 +23,5 @@
|
|||
],
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"../../../tools/changelogger/PackageFormatter.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"class": "PackageFormatter"
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": [
|
||||
"Fix",
|
||||
|
@ -23,10 +23,5 @@
|
|||
],
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"../../../tools/changelogger/PackageFormatter.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"class": "PackageFormatter"
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": [
|
||||
"Fix",
|
||||
|
@ -23,10 +23,5 @@
|
|||
],
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"../../../tools/changelogger/PackageFormatter.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"class": "PackageFormatter"
|
||||
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||
},
|
||||
"types": [
|
||||
"Fix",
|
||||
|
@ -23,10 +23,5 @@
|
|||
],
|
||||
"changelog": "NEXT_CHANGELOG.md"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"../../../tools/changelogger/PackageFormatter.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1153,5 +1153,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.3"
|
||||
},
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
|
|
@ -411,5 +411,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
|
|
@ -1697,5 +1697,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
|
|
@ -164,16 +164,16 @@
|
|||
},
|
||||
{
|
||||
"name": "mck89/peast",
|
||||
"version": "v1.13.8",
|
||||
"version": "v1.13.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mck89/peast.git",
|
||||
"reference": "4f0423441ec557f3935b056d10987f2e1c7a3e76"
|
||||
"reference": "5329e997fb50e0b82ca8f6e4164f92941f689b47"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mck89/peast/zipball/4f0423441ec557f3935b056d10987f2e1c7a3e76",
|
||||
"reference": "4f0423441ec557f3935b056d10987f2e1c7a3e76",
|
||||
"url": "https://api.github.com/repos/mck89/peast/zipball/5329e997fb50e0b82ca8f6e4164f92941f689b47",
|
||||
"reference": "5329e997fb50e0b82ca8f6e4164f92941f689b47",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -185,7 +185,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.13.8-dev"
|
||||
"dev-master": "1.13.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -207,9 +207,9 @@
|
|||
"description": "Peast is PHP library that generates AST for JavaScript code",
|
||||
"support": {
|
||||
"issues": "https://github.com/mck89/peast/issues",
|
||||
"source": "https://github.com/mck89/peast/tree/v1.13.8"
|
||||
"source": "https://github.com/mck89/peast/tree/v1.13.9"
|
||||
},
|
||||
"time": "2021-09-11T10:28:18+00:00"
|
||||
"time": "2021-11-12T13:44:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mustache/mustache",
|
||||
|
@ -624,5 +624,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
|
|
@ -55,10 +55,7 @@
|
|||
},
|
||||
"psr-0": {
|
||||
"Automattic\\WooCommerce\\Vendor\\": "lib/packages/"
|
||||
},
|
||||
"files": [
|
||||
"../../tools/changelogger/PluginFormatter.php"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
@ -123,7 +120,7 @@
|
|||
},
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"class": "PluginFormatter"
|
||||
"filename": "../../tools/changelogger/PluginFormatter.php"
|
||||
},
|
||||
"types": [
|
||||
"Fix",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "8d115ec1c2d2dab03533d674edb48a44",
|
||||
"content-hash": "f6fc527d8719df0b0247ee188eb3eee9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "automattic/jetpack-autoloader",
|
||||
|
@ -2923,5 +2923,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0.33"
|
||||
},
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\MonorepoTools\Changelogger;
|
||||
|
||||
/**
|
||||
* Base Jetpack Changelogger Formatter for WooCommerce
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Changelog\Changelog;
|
||||
use Automattic\Jetpack\Changelog\KeepAChangelogParser;
|
||||
use Automattic\Jetpack\Changelogger\FormatterPlugin;
|
||||
use Automattic\Jetpack\Changelogger\PluginTrait;
|
||||
|
||||
/**
|
||||
* Base Jetpack Changelogger Formatter for WooCommerce
|
||||
*
|
||||
* Note: Since the "filename" loading relies on a single class implementing the plugin interface,
|
||||
* we have to implement it in the child class, even though the base class satisfies it.
|
||||
*
|
||||
* Class Formatter
|
||||
*/
|
||||
class Formatter extends KeepAChangelogParser implements FormatterPlugin {
|
||||
class Formatter extends KeepAChangelogParser {
|
||||
use PluginTrait;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +66,7 @@ class Formatter extends KeepAChangelogParser implements FormatterPlugin {
|
|||
/**
|
||||
* Get Release link given a version number.
|
||||
*
|
||||
* @throws InvalidArgumentException When directory parsing fails.
|
||||
* @throws \InvalidArgumentException When directory parsing fails.
|
||||
* @param string $version Release version.
|
||||
*
|
||||
* @return string Link to the version's release.
|
||||
|
@ -76,13 +81,13 @@ class Formatter extends KeepAChangelogParser implements FormatterPlugin {
|
|||
preg_match( '/\/woocommerce\/(.+)/', getcwd(), $path );
|
||||
|
||||
if ( ! count( $path ) ) {
|
||||
throw new InvalidArgumentException( 'Invalid directory.' );
|
||||
throw new \InvalidArgumentException( 'Invalid directory.' );
|
||||
}
|
||||
|
||||
$release_url = $path_map[ $path[1] ];
|
||||
|
||||
if ( ! $release_url ) {
|
||||
throw new InvalidArgumentException( 'Release URL not found.' );
|
||||
throw new \InvalidArgumentException( 'Release URL not found.' );
|
||||
}
|
||||
|
||||
return $release_url . $version;
|
||||
|
@ -93,7 +98,7 @@ class Formatter extends KeepAChangelogParser implements FormatterPlugin {
|
|||
*
|
||||
* @param string $changelog Changelog contents.
|
||||
* @return Changelog
|
||||
* @throws InvalidArgumentException If the changelog data cannot be parsed.
|
||||
* @throws \InvalidArgumentException If the changelog data cannot be parsed.
|
||||
*/
|
||||
public function parse( $changelog ) {
|
||||
$ret = new Changelog();
|
||||
|
@ -131,7 +136,7 @@ class Formatter extends KeepAChangelogParser implements FormatterPlugin {
|
|||
$is_subentry = count( $subheading ) > 0;
|
||||
|
||||
if ( ! count( $heading ) && ! count( $subheading ) ) {
|
||||
throw new InvalidArgumentException( 'Invalid heading' );
|
||||
throw new \InvalidArgumentException( 'Invalid heading' );
|
||||
}
|
||||
|
||||
$version = '';
|
||||
|
@ -145,11 +150,11 @@ class Formatter extends KeepAChangelogParser implements FormatterPlugin {
|
|||
try {
|
||||
$timestamp = new DateTime( $timestamp, new DateTimeZone( 'UTC' ) );
|
||||
} catch ( \Exception $ex ) {
|
||||
throw new InvalidArgumentException( "Heading has an invalid timestamp: $heading", 0, $ex );
|
||||
throw new \InvalidArgumentException( "Heading has an invalid timestamp: $heading", 0, $ex );
|
||||
}
|
||||
|
||||
if ( strtotime( $heading[2], 0 ) !== strtotime( $heading[2], 1000000000 ) ) {
|
||||
throw new InvalidArgumentException( "Heading has a relative timestamp: $heading" );
|
||||
throw new \InvalidArgumentException( "Heading has a relative timestamp: $heading" );
|
||||
}
|
||||
$entry_timestamp = $timestamp;
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\MonorepoTools\Changelogger;
|
||||
|
||||
use Automattic\Jetpack\Changelogger\FormatterPlugin;
|
||||
|
||||
/**
|
||||
* Jetpack Changelogger Formatter for WooCommerce packages
|
||||
*/
|
||||
|
@ -10,7 +15,7 @@ require_once 'Formatter.php';
|
|||
*
|
||||
* Class Formatter
|
||||
*/
|
||||
class PackageFormatter extends Formatter {
|
||||
class PackageFormatter extends Formatter implements FormatterPlugin {
|
||||
/**
|
||||
* Prologue text.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\MonorepoTools\Changelogger;
|
||||
|
||||
use Automattic\Jetpack\Changelogger\FormatterPlugin;
|
||||
|
||||
/**
|
||||
* Jetpack Changelogger Formatter for WooCommerce plugins
|
||||
*/
|
||||
|
@ -10,7 +15,7 @@ require_once 'Formatter.php';
|
|||
*
|
||||
* Class Formatter
|
||||
*/
|
||||
class PluginFormatter extends Formatter {
|
||||
class PluginFormatter extends Formatter implements FormatterPlugin {
|
||||
/**
|
||||
* Epilogue text.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue