Skip to content

Commit

Permalink
Removed testing polyfills that will be deprecated in next versions fr…
Browse files Browse the repository at this point in the history
…om Changelogger. (#40162)

* Expanded the yoast/phpunit-polyfill package allowed versions.

* Changelog.

* Brought the v1 requirements back.

* Removed unneeded polyfill in ChangeEntryTest.

* ChangelogEntryTest fixes.

* ChangelogTest fixes.

* CommandLoaderTest fixes.

* ConfigTest fix.

* SemverVersioningTest fixes.

* WordPressVersioningTest fixes.

* UtilsTest fixes.

* Static fixtures for parent test case.

* AddCommandTest fixes.

* SquashCommandTest fix.

* VersionCommandTest fix.

* VersionCommandTest fix.

* WriteCommandTest fix.

* Update projects/packages/changelogger/composer.json

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

* Updated plugin lock files.

* Changelogs.

* Lock update."

* Changelog.

* Disabled GPG signing for test commits.

* Try updating PHPUnit XML configuration.

* Reverted PHPUnit configuration and polyfills back to original state.

* Revert "Lock update.""

This reverts commit 8b94c27.

* Revert "Changelogs."

This reverts commit 310ec93.

* Revert "Updated plugin lock files."

This reverts commit e278348.

* Revert "Changelog."

This reverts commit d8b64dd.

* Disable global git config instead of disabling signatures.

---------

Co-authored-by: Brandon Kraft <public@brandonkraft.com>
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 88204ab commit 1352759
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Upgraded dependency yoast/phpunit-polyfill to allow for upgrades.


Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ParserTestCase extends TestCase {
*
* @var string
*/
protected $fixtures;
protected static $fixtures;

/**
* Set to update fixture files after running tests.
Expand Down Expand Up @@ -275,9 +275,9 @@ public function testFixture( $filename ) {
/**
* Data provider for testFixture.
*/
public function provideFixture() {
public static function provideFixture() {
$ret = array();
foreach ( glob( $this->fixtures ) as $filename ) {
foreach ( glob( static::$fixtures ) as $filename ) {
$ret[ basename( $filename ) ] = array( $filename );
}
return $ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* @covers \Automattic\Jetpack\Changelog\ChangeEntry
*/
class ChangeEntryTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test general getters.
Expand Down Expand Up @@ -115,7 +114,7 @@ public function testCompare( ChangeEntry $a, ChangeEntry $b, array $config, $exp
/**
* Data provider for testCompare.
*/
public function provideCompare() {
public static function provideCompare() {
return array(
'Default config, equal' => array(
new ChangeEntry(
Expand Down Expand Up @@ -414,7 +413,7 @@ public function testJson( $json, $change ) {
/**
* Data provider for testJson.
*/
public function provideJson() {
public static function provideJson() {
return array(
'Basic serialization' => array(
'{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":null,"timestamp":"2021-02-18T00:00:00+0000","subheading":"","author":"","content":""}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* @covers \Automattic\Jetpack\Changelog\ChangelogEntry
*/
class ChangelogEntryTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test general getters.
Expand Down Expand Up @@ -239,7 +238,7 @@ public function testJson( $json, $entry ) {
/**
* Data provider for testJson.
*/
public function provideJson() {
public static function provideJson() {
return array(
'Basic serialization' => array(
'{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangelogEntry","version":"1.0","link":null,"timestamp":"2021-02-18T00:00:00+0000","prologue":"","epilogue":"","changes":[]}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* @covers \Automattic\Jetpack\Changelog\Changelog
*/
class ChangelogTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test prologue and epilogue.
Expand Down Expand Up @@ -109,7 +108,7 @@ public function testJson( $json, $changelog ) {
/**
* Data provider for testJson.
*/
public function provideJson() {
public static function provideJson() {
return array(
'Basic serialization' => array(
'{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\Changelog","prologue":"","epilogue":"","entries":[]}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* @covers \Automattic\Jetpack\Changelog\KeepAChangelogParser
*/
class KeepAChangelogParserTest extends ParserTestCase {
protected $className = KeepAChangelogParser::class;
protected $fixtures = __DIR__ . '/fixtures/KeepAChangelogParserTest.*.md';
protected $className = KeepAChangelogParser::class;
protected static $fixtures = __DIR__ . '/fixtures/KeepAChangelogParserTest.*.md';
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function testGetDefaultFilename() {
array(
'mustRun' => true,
'env' => array(
'GIT_CONFIG_GLOBAL' => '/dev/null',
'GIT_AUTHOR_NAME' => 'Dummy',
'GIT_AUTHOR_EMAIL' => 'dummy@example.com',
'GIT_COMMITTER_NAME' => 'Dummy',
Expand Down Expand Up @@ -163,7 +164,7 @@ public function testExecute( array $args, array $options, array $inputs, $expect
/**
* Data provider for testExecute.
*/
public function provideExecute() {
public static function provideExecute() {
$composerWithTypes = array(
'extra' => array(
'changelogger' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* @covers \Automattic\Jetpack\Changelogger\CommandLoader
*/
class CommandLoaderTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test `has()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* @covers \Automattic\Jetpack\Changelogger\Config
*/
class ConfigTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Set up.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class SemverVersioningTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test parseVersion and normalizeVersion.
Expand All @@ -46,7 +45,7 @@ public function testParseVersion( $version, $expect, $normalized = null ) {
/**
* Data provider for testParseVersion.
*/
public function provideParseVersion() {
public static function provideParseVersion() {
return array(
array(
'1.2.3',
Expand Down Expand Up @@ -199,7 +198,7 @@ public function testNormalizeVersion( $version, $expect, $extra = array() ) {
/**
* Data provider for testNormalizeVersion.
*/
public function provideNormalizeVersion() {
public static function provideNormalizeVersion() {
return array(
'add prerelease = alpha' => array(
'1.2.3',
Expand Down Expand Up @@ -278,7 +277,7 @@ public function testNextVersion( $version, array $changes, array $extra, $expect
/**
* Data provider for testNextVersion.
*/
public function provideNextVersion() {
public static function provideNextVersion() {
return array(
'No changes' => array(
'1.2.3',
Expand Down Expand Up @@ -427,7 +426,7 @@ public function testCompareVersions( $a, $expect, $b ) {
/**
* Data provider for testCompareVersions.
*/
public function provideCompareVersions() {
public static function provideCompareVersions() {
return array(
array( '1.0.0', '==', '1.0.0' ),
array( '1.0.0', '<', '2.0.0' ),
Expand Down Expand Up @@ -477,7 +476,7 @@ public function testFirstVersion( array $extra, $expect ) {
/**
* Data provider for testFirstVersion.
*/
public function provideFirstVersion() {
public static function provideFirstVersion() {
return array(
'Normal' => array(
array(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class WordpressVersioningTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test getOptions.
Expand Down Expand Up @@ -60,7 +59,7 @@ public function testParseVersion( $version, $expect, $normalized = null ) {
/**
* Data provider for testParseVersion.
*/
public function provideParseVersion() {
public static function provideParseVersion() {
return array(
array(
'1.2',
Expand Down Expand Up @@ -289,7 +288,7 @@ public function testNormalizeVersion( $version, $expect, $extra = array() ) {
/**
* Data provider for testNormalizeVersion.
*/
public function provideNormalizeVersion() {
public static function provideNormalizeVersion() {
return array(
'add prerelease = alpha' => array(
'1.2',
Expand Down Expand Up @@ -367,7 +366,7 @@ public function testNextVersion( $version, array $changes, array $extra, $expect
/**
* Data provider for testNextVersion.
*/
public function provideNextVersion() {
public static function provideNextVersion() {
return array(
'No changes' => array(
'1.2.3',
Expand Down Expand Up @@ -494,7 +493,7 @@ public function testCompareVersions( $a, $expect, $b ) {
/**
* Data provider for testCompareVersions.
*/
public function provideCompareVersions() {
public static function provideCompareVersions() {
return array(
array( '1.0', '==', '1.0' ),
array( '1.0.0', '==', '1.0' ),
Expand Down Expand Up @@ -546,7 +545,7 @@ public function testFirstVersion( array $extra, $expect ) {
/**
* Data provider for testFirstVersion.
*/
public function provideFirstVersion() {
public static function provideFirstVersion() {
return array(
'Normal' => array(
array(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testExecute( array $args, array $options, array $inputs, $expect
/**
* Data provider for testExecute.
*/
public function provideExecute() {
public static function provideExecute() {
return array(
'Normal run' => array(
array(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class UtilsTest extends TestCase {
use \Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
use \Yoast\PHPUnitPolyfills\Polyfills\AssertObjectProperty;
use \Yoast\PHPUnitPolyfills\Polyfills\AssertionRenames;
use \Yoast\PHPUnitPolyfills\Polyfills\ExpectException;

/**
* Test runCommand.
Expand Down Expand Up @@ -64,7 +63,7 @@ public function testRunCommand( $cmd, $options, $expectExitCode, $expectStdout,
/**
* Data provider for testRunCommand.
*/
public function provideRunCommand() {
public static function provideRunCommand() {
$tmp = realpath( sys_get_temp_dir() );

return array(
Expand Down Expand Up @@ -178,7 +177,7 @@ public function testLoadChangeFile( $contents, $expect, $expectDiagnostics = arr
/**
* Data provider for testLoadChangeFile.
*/
public function provideLoadChangeFile() {
public static function provideLoadChangeFile() {
$ex = function ( $msg, $line ) {
$ret = new LoadChangeFileException( $msg );
$ret->fileLine = $line;
Expand Down Expand Up @@ -367,6 +366,7 @@ public function testGetRepoData() {
array(
'mustRun' => true,
'env' => array(
'GIT_CONFIG_GLOBAL' => '/dev/null',
'GIT_AUTHOR_NAME' => 'Dummy',
'GIT_AUTHOR_EMAIL' => 'dummy@example.com',
'GIT_AUTHOR_DATE' => '2021-01-01T11:11:11Z',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testExecute( array $args, array $options, $expectExitCode, $expe
/**
* Data provider for testExecute.
*/
public function provideExecute() {
public static function provideExecute() {
$composerWithTypes = array(
'extra' => array(
'changelogger' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testExecute( array $args, array $options, $expectExitCode, $expe
/**
* Data provider for testExecute.
*/
public function provideExecute() {
public static function provideExecute() {
$changelog = "## 2.0.0 - 2021-02-22\n\n## 1.0.0 - 2021-02-21\n";

return array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testExecute( array $args, array $options, array $inputs, $expect
/**
* Data provider for testExecute.
*/
public function provideExecute() {
public static function provideExecute() {
$date = gmdate( 'Y-m-d' );

return array(
Expand Down

0 comments on commit 1352759

Please sign in to comment.