Skip to content

Commit 8c3e052

Browse files
obenlandpfefferle
andauthored
Bump minimum version to PHP 7.2 (#1139)
* Bump minimum version to PHP 7.2+ * Upgrade phpunit * Fix tests for WP 5.9 --------- Co-authored-by: Matthias Pfefferle <[email protected]>
1 parent 2cbdfb8 commit 8c3e052

File tree

10 files changed

+25
-17
lines changed

10 files changed

+25
-17
lines changed

.github/workflows/phpunit.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ jobs:
1515
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
1616
strategy:
1717
matrix:
18-
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
18+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1919
include:
2020
- wp-version: latest
21-
- wp-version: '6.5'
22-
php-versions: '7.0'
23-
- wp-version: '6.5'
24-
php-versions: '7.1'
21+
- wp-version: '5.9'
22+
php-versions: '7.2'
2523
steps:
2624
- name: Install svn
2725
run: |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Changed
1515

1616
* Hide ActivityPub post meta keys from the custom Fields UI
17+
* Bumped minimum required PHP version to 7.2
1718

1819
### Fixed
1920

activitypub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Author URI: https://automattic.com/
99
* License: MIT
1010
* License URI: http://opensource.org/licenses/MIT
11-
* Requires PHP: 7.0
11+
* Requires PHP: 7.2
1212
* Text Domain: activitypub
1313
* Domain Path: /languages
1414
*

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"description": "The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.",
44
"type": "wordpress-plugin",
55
"require": {
6-
"php": ">=7.0",
6+
"php": ">=7.2",
77
"composer/installers": "^1.0 || ^2.0"
88
},
99
"require-dev": {
10-
"phpunit/phpunit": "^5.7.21 || ^6.5 || ^7.5 || ^8",
10+
"phpunit/phpunit": "^8 || ^9",
1111
"phpcompatibility/php-compatibility": "*",
1212
"phpcompatibility/phpcompatibility-wp": "*",
1313
"squizlabs/php_codesniffer": "3.*",

phpcs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
<arg name="parallel" value="50"/>
1515

1616
<rule ref="PHPCompatibility"/>
17-
<config name="testVersion" value="7.0-"/>
17+
<config name="testVersion" value="7.2-"/>
1818
<rule ref="PHPCompatibilityWP"/>
19-
<config name="minimum_supported_wp_version" value="4.7"/>
19+
<config name="minimum_supported_wp_version" value="5.5"/>
2020

2121
<config name="text_domain" value="activitypub,default"/>
2222

phpunit.xml.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
<directory prefix="class-test-" suffix=".php">./tests</directory>
1212
</testsuite>
1313
</testsuites>
14-
<!--
1514
<listeners>
1615
<listener class="Activitypub\Tests\Activitypub_Testcase_Timer" file="tests/class-activitypub-testcase-timer.php" />
1716
</listeners>
18-
-->
1917
</phpunit>

readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: OStatus, fediverse, activitypub, activitystream
44
Requires at least: 5.5
55
Tested up to: 6.7
66
Stable tag: 4.6.0
7-
Requires PHP: 7.0
7+
Requires PHP: 7.2
88
License: MIT
99
License URI: http://opensource.org/licenses/MIT
1010

@@ -136,6 +136,7 @@ For reasons of data protection, it is not possible to see the followers of other
136136

137137
* Added: A filter to make custom comment types manageable in WP.com Calypso
138138
* Changed: Hide ActivityPub post meta keys from the custom Fields UI
139+
* Changed: Bumped minimum required PHP version to 7.2
139140
* Fixed: Undefined array key warnings in various places
140141
* Fixed: Fetching replies from the same instance for Enable Mastodon Apps
141142
* Fixed: Image captions not being included in the ActivityPub representation when the image is attached to the post

tests/includes/collection/class-test-followers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ public function test_add_follower() {
129129
$db_followers = Followers::get_followers( 1 );
130130
$db_followers2 = Followers::get_followers( 2 );
131131

132-
$this->assertContains( $follower, $db_followers );
133-
$this->assertContains( $follower2, $db_followers2 );
132+
$this->assertStringContainsString( $follower, serialize( $db_followers ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
133+
$this->assertStringContainsString( $follower2, serialize( $db_followers2 ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
134134
}
135135

136136
/**
@@ -329,7 +329,7 @@ public function test_add_duplicate_follower() {
329329

330330
$db_followers = Followers::get_followers( 1 );
331331

332-
$this->assertContains( $follower, $db_followers );
332+
$this->assertStringContainsString( $follower, serialize( $db_followers ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
333333

334334
$follower = current( $db_followers );
335335
$meta = get_post_meta( $follower->get__id(), '_activitypub_user_id', false );

tests/includes/rest/class-test-signature-verification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function test_activity_signature() {
4747
$date = gmdate( 'D, d M Y H:i:s T' );
4848
$signature = Signature::generate_signature( 1, 'POST', $remote_actor, $date, $digest );
4949

50-
$this->assertRegExp( '/keyId="http:\/\/example\.org\/\?author=1#main-key",algorithm="rsa-sha256",headers="\(request-target\) host date digest",signature="[^"]*"/', $signature );
50+
$this->assertMatchesRegularExpression( '/keyId="http:\/\/example\.org\/\?author=1#main-key",algorithm="rsa-sha256",headers="\(request-target\) host date digest",signature="[^"]*"/', $signature );
5151

5252
// Signed headers.
5353
$url_parts = wp_parse_url( $remote_actor );

tests/includes/transformer/class-test-post.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,16 @@ public function test_block_attachments_with_fallback() {
370370
)
371371
);
372372

373+
// For WP versions 6.1 and prior, we only look for attached images.
374+
if ( ! class_exists( 'WP_HTML_Tag_Processor' ) ) {
375+
wp_update_post(
376+
array(
377+
'ID' => $attachment_id,
378+
'post_parent' => $post_id,
379+
)
380+
);
381+
}
382+
373383
$object = Post::transform( get_post( $post_id ) )->to_object();
374384

375385
$this->assertEquals(

0 commit comments

Comments
 (0)