Skip to content

Commit 66a9ace

Browse files
anthonyburchellrfmeierAnthony Burchell
authored
Ending support of PHP 5.2 (#273)
* Removed post-update-cmd and post-install-cmd from composer file. * Removed composer.json and composer.lock file from php52 directory. * removes 5.2 support * Removed references to php52. * Replaced old test boostrap with modern one. * Removed phpunit phpunit6-compat.php file. No longer needed. * Removed old php versions from list. No longer needed. * Pinned squizlabs/php_codesniffer to version 2.9.2 until support for php 7.4 can be implemented. * Removed php version conditional for vendor/autoload.php include. Co-authored-by: Ryan Meier <[email protected]> Co-authored-by: Anthony Burchell <[email protected]>
1 parent b4f5e38 commit 66a9ace

File tree

11 files changed

+28
-305
lines changed

11 files changed

+28
-305
lines changed

.distignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
+ php52/vendor/bin
21
+ vendor/bin
32
- bin
43
.circleci

build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ rsync \
2020
--include="src/**" \
2121
--include='vendor' \
2222
--include='vendor/**' \
23-
--include='php52' \
24-
--include='php52/**' \
2523
--exclude="*" \
2624
./ ./build/trunk
2725

composer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@
77
"email": "[email protected]"
88
}],
99
"require": {
10-
"squizlabs/php_codesniffer": "^2.9.2",
1110
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
12-
"phpcompatibility/phpcompatibility-wp": "^2"
11+
"phpcompatibility/phpcompatibility-wp": "^2",
12+
"squizlabs/php_codesniffer": "2.9.2"
1313
},
1414
"require-dev": {
1515
"wp-coding-standards/wpcs": "^1",
1616
"phpunit/phpunit": "^5"
1717
},
1818
"scripts": {
19-
"post-update-cmd": [
20-
"cd php52; composer update; cd .."
21-
],
22-
"post-install-cmd": [
23-
"cd php52; composer install; cd .."
24-
],
2519
"phpcs": "phpcs --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php",
2620
"phpcs:fix": "phpcbf --standard=src/ruleset-wordpress.xml wpengine-phpcompat.php load-files.php src/*.php",
2721
"test": "phpunit"

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

load-files.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616
*/
1717
function wpephpcompat_load_files() {
1818
require_once dirname( __FILE__ ) . '/src/wpephpcompat.php';
19-
20-
if ( version_compare( phpversion(), '5.3', '<' ) ) {
21-
$autoload_file = dirname( __FILE__ ) . '/php52/vendor/autoload_52.php';
22-
} else {
23-
$autoload_file = dirname( __FILE__ ) . '/vendor/autoload.php';
24-
}
25-
26-
require_once $autoload_file;
19+
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
2720

2821
if ( defined( 'WP_CLI' ) && WP_CLI ) {
2922
require_once dirname( __FILE__ ) . '/src/wpcli.php';

php-lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
find . -not \( -path ./vendor -prune \) -not \( -path ./php52 -prune \) -type f -name '*.php' -print0 | xargs -0 -n1 -P4 -I {} php -l -n {} | (! grep -v "No syntax errors detected" )
3+
find . -not \( -path ./vendor -prune \) -type f -name '*.php' -print0 | xargs -0 -n1 -P4 -I {} php -l -n {} | (! grep -v "No syntax errors detected" )

php52/composer.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

php52/composer.lock

Lines changed: 0 additions & 172 deletions
This file was deleted.

tests/phpunit/bootstrap.php

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
<?php
2+
/**
3+
* PHPUnit bootstrap file
4+
*
5+
* @package Sample_Plugin
6+
*/
27

3-
// Disable xdebug backtrace.
4-
if ( function_exists( 'xdebug_disable' ) ) {
5-
xdebug_disable();
6-
}
8+
$_tests_dir = getenv( 'WP_TESTS_DIR' );
79

8-
if ( false !== getenv( 'WP_PLUGIN_DIR' ) ) {
9-
define( 'WP_PLUGIN_DIR', getenv( 'WP_PLUGIN_DIR' ) );
10+
if ( ! $_tests_dir ) {
11+
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
1012
}
1113

12-
$GLOBALS['wp_tests_options'] = array(
13-
'active_plugins' => array( basename( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/wpengine-phpcompat.php' ),
14-
);
15-
16-
if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
17-
$test_root = getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit';
18-
} elseif ( file_exists( '/tmp/wordpress-tests-lib/includes/bootstrap.php' ) ) {
19-
$test_root = '/tmp/wordpress-tests-lib';
20-
} else {
21-
$test_root = '../../../../../../../tests/phpunit';
14+
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
15+
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
16+
exit( 1 );
2217
}
2318

24-
if ( file_exists( $test_root . '/includes/functions.php' ) ) {
25-
require_once $test_root . '/includes/functions.php';
26-
function _manually_load_plugin() {
27-
require dirname( __FILE__ ) . '/../../wpengine-phpcompat.php';
28-
}
29-
30-
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
31-
}
19+
// Give access to tests_add_filter() function.
20+
require_once $_tests_dir . '/includes/functions.php';
3221

33-
// Core started including their own phpunit6-compat, so we should use that if we can.
34-
if ( ! file_exists( $test_root . '/includes/phpunit6/compat.php' ) ) {
35-
// WordPress versions before 4.8 will be incompatible with newer PHPUnit versions.
36-
if ( version_compare( getenv( 'WP_VERSION' ), '4.8', '<' ) && class_exists( 'PHPUnit\Runner\Version' ) ) {
37-
require_once dirname( __FILE__ ) . '/phpunit6-compat.php';
38-
}
22+
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
23+
/**
24+
* Manually load the plugin being tested.
25+
*/
26+
function _manually_load_plugin() {
27+
require dirname( dirname( dirname( __FILE__ ) ) ) . '/wpengine-phpcompat.php';
3928
}
4029

41-
require $test_root . '/includes/bootstrap.php';
30+
// Start up the WP testing environment.
31+
require $_tests_dir . '/includes/bootstrap.php';

tests/phpunit/phpunit6-compat.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)