Skip to content

Commit 673ce74

Browse files
committed
Docker testing entrypoint script refactored to work better with old versions of PHP.
1 parent c0b39bc commit 673ce74

File tree

8 files changed

+40
-25
lines changed

8 files changed

+40
-25
lines changed

.github/workflows/continous-integration.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ jobs:
3333
- php: '7.3'
3434
wordpress: '5.0'
3535
debug: 1
36+
- php: '7.1'
37+
- lowest: 1
38+
- php: '7.2'
39+
- lowest: 1
3640

3741
fail-fast: false
3842
name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
@@ -59,21 +63,22 @@ jobs:
5963
restore-keys: ${{ runner.os }}-composer-
6064

6165
- name: Install dependencies
62-
run: composer install
66+
run: composer install --no-dev
6367

6468
- name: Build "testing" Docker Image
6569
env:
6670
PHP_VERSION: ${{ matrix.php }}
6771
WP_VERSION: ${{ matrix.wordpress }}
6872
USE_XDEBUG: ${{ matrix.use_xdebug }}
69-
run: bin/run-docker.sh build -t
73+
run: composer build-test
7074

7175
- name: Run Tests w/ Docker.
7276
env:
7377
COVERAGE: ${{ matrix.coverage }}
7478
DEBUG: ${{ matrix.debug }}
7579
SKIP_TESTS_CLEANUP: ${{ matrix.coverage }}
76-
run: bin/run-docker.sh run -t
80+
LOWEST: ${{ matrix.lowest }}
81+
run: composer run-test
7782

7883
- name: Push Codecoverage to Coveralls.io
7984
if: ${{ matrix.coverage == 1 && env.STRIPE_API_PUBLISHABLE_KEY != 0 }}

bin/run-docker.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22

33
set -eu
44

5+
##
6+
# Use this script through Composer scripts in the package.json.
7+
# To quickly build and run the docker-compose scripts for an app or automated testing
8+
# run the command below after run `composer install --no-dev` with the respectively
9+
# flag for what you need.
10+
##
511
print_usage_instructions() {
6-
echo "Usage: $0 build|run [-e=env-file ] [-a|-t]";
12+
echo "Usage: composer build-and-run -- [-a|-t]";
13+
echo " -a Spin up a WordPress installation.";
14+
echo " -t Run the automated tests.";
715
exit 1
816
}
917

@@ -62,6 +70,7 @@ case "$subcommand" in
6270
-e COVERAGE=${COVERAGE-} \
6371
-e DEBUG=${DEBUG-} \
6472
-e SKIP_TESTS_CLEANUP=${SKIP_TESTS_CLEANUP-} \
73+
-e LOWEST=${LOWEST-} \
6574
testing --scale app=0
6675
;;
6776
\? ) print_usage_instructions;;

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
],
2323
"require": {
24-
"php": ">=5.6.0",
24+
"php": ">=7.1.0",
2525
"firebase/php-jwt": "^5.0"
2626
},
2727
"require-dev": {
@@ -57,14 +57,13 @@
5757
"docker-run": "bash bin/run-docker.sh run",
5858
"docker-destroy": "docker-compose down",
5959
"build-and-run": [
60-
"Composer\\Config::disableProcessTimeout",
6160
"@docker-build",
6261
"@docker-run"
6362
],
64-
"build-local-app": "@docker-build -a",
65-
"build-local-test": "@docker-build -t",
66-
"run-local-app": "@docker-run -a",
67-
"run-local-test": "@docker-run -t",
63+
"build-app": "@docker-build -a",
64+
"build-test": "@docker-build -t",
65+
"run-app": "@docker-run -a",
66+
"run-test": "@docker-run -t",
6867
"lint": "vendor/bin/phpcs"
6968
},
7069
"support" : {

docker/testing.entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ if [ ! -f "$PROJECT_DIR/c3.php" ]; then
6666
curl -L 'https://raw.github.com/Codeception/c3/2.0/c3.php' > "$PROJECT_DIR/c3.php"
6767
fi
6868

69+
if [[ -n "$LOWEST" ]]; then
70+
PREFER_LOWEST="--prefer-source"
71+
fi
72+
6973
# Install dependencies
74+
COMPOSER_MEMORY_LIMIT=-1 composer update --prefer-source ${PREFER_LOWEST}
7075
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-source --no-interaction
7176

7277
# Install pcov/clobber if PHP7.1+

tests/wpunit/IntrospectionQueryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public function testIntrospectionQuery() {
4444
$query = \GraphQL\Type\Introspection::getIntrospectionQuery();
4545
$results = graphql( array( 'query' => $query ) );
4646

47-
// use --debug flag to view.
48-
codecept_debug( $results );
49-
5047
$this->assertArrayNotHasKey('errors', $results );
5148
}
5249
}

vendor/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
require_once __DIR__ . '/composer/autoload_real.php';
66

7-
return ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991::getLoader();
7+
return ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5::getLoader();

vendor/composer/autoload_real.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991
5+
class ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5
66
{
77
private static $loader;
88

@@ -22,15 +22,15 @@ public static function getLoader()
2222
return self::$loader;
2323
}
2424

25-
spl_autoload_register(array('ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991', 'loadClassLoader'), true, true);
25+
spl_autoload_register(array('ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5', 'loadClassLoader'), true, true);
2626
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27-
spl_autoload_unregister(array('ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991', 'loadClassLoader'));
27+
spl_autoload_unregister(array('ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5', 'loadClassLoader'));
2828

2929
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
3030
if ($useStaticLoader) {
3131
require_once __DIR__ . '/autoload_static.php';
3232

33-
call_user_func(\Composer\Autoload\ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::getInitializer($loader));
33+
call_user_func(\Composer\Autoload\ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::getInitializer($loader));
3434
} else {
3535
$map = require __DIR__ . '/autoload_namespaces.php';
3636
foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ public static function getLoader()
5151
$loader->register(true);
5252

5353
if ($useStaticLoader) {
54-
$includeFiles = Composer\Autoload\ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$files;
54+
$includeFiles = Composer\Autoload\ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$files;
5555
} else {
5656
$includeFiles = require __DIR__ . '/autoload_files.php';
5757
}
5858
foreach ($includeFiles as $fileIdentifier => $file) {
59-
composerRequire2fa8cc4089933233a2ec1576fa073991($fileIdentifier, $file);
59+
composerRequire8f9529f1e65fdb8a7b8596df063296d5($fileIdentifier, $file);
6060
}
6161

6262
return $loader;
6363
}
6464
}
6565

66-
function composerRequire2fa8cc4089933233a2ec1576fa073991($fileIdentifier, $file)
66+
function composerRequire8f9529f1e65fdb8a7b8596df063296d5($fileIdentifier, $file)
6767
{
6868
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
6969
require $file;

vendor/composer/autoload_static.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Composer\Autoload;
66

7-
class ComposerStaticInit2fa8cc4089933233a2ec1576fa073991
7+
class ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5
88
{
99
public static $files = array (
1010
'944484f100dc1864a5320474d49ebd5a' => __DIR__ . '/../..' . '/includes/connection/wc-cpt-connection-args.php',
@@ -176,9 +176,9 @@ class ComposerStaticInit2fa8cc4089933233a2ec1576fa073991
176176
public static function getInitializer(ClassLoader $loader)
177177
{
178178
return \Closure::bind(function () use ($loader) {
179-
$loader->prefixLengthsPsr4 = ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$prefixLengthsPsr4;
180-
$loader->prefixDirsPsr4 = ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$prefixDirsPsr4;
181-
$loader->classMap = ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$classMap;
179+
$loader->prefixLengthsPsr4 = ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$prefixLengthsPsr4;
180+
$loader->prefixDirsPsr4 = ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$prefixDirsPsr4;
181+
$loader->classMap = ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$classMap;
182182

183183
}, null, ClassLoader::class);
184184
}

0 commit comments

Comments
 (0)