Docker testing entrypoint script refactored to work better with old versions of PHP.

This commit is contained in:
Geoff Taylor
2020-10-15 00:55:33 -04:00
parent c0b39bc1e1
commit 673ce74547
8 changed files with 40 additions and 25 deletions
+8 -3
View File
@@ -33,6 +33,10 @@ jobs:
- php: '7.3'
wordpress: '5.0'
debug: 1
- php: '7.1'
- lowest: 1
- php: '7.2'
- lowest: 1
fail-fast: false
name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
@@ -59,21 +63,22 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install
run: composer install --no-dev
- name: Build "testing" Docker Image
env:
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
USE_XDEBUG: ${{ matrix.use_xdebug }}
run: bin/run-docker.sh build -t
run: composer build-test
- name: Run Tests w/ Docker.
env:
COVERAGE: ${{ matrix.coverage }}
DEBUG: ${{ matrix.debug }}
SKIP_TESTS_CLEANUP: ${{ matrix.coverage }}
run: bin/run-docker.sh run -t
LOWEST: ${{ matrix.lowest }}
run: composer run-test
- name: Push Codecoverage to Coveralls.io
if: ${{ matrix.coverage == 1 && env.STRIPE_API_PUBLISHABLE_KEY != 0 }}
+10 -1
View File
@@ -2,8 +2,16 @@
set -eu
##
# Use this script through Composer scripts in the package.json.
# To quickly build and run the docker-compose scripts for an app or automated testing
# run the command below after run `composer install --no-dev` with the respectively
# flag for what you need.
##
print_usage_instructions() {
echo "Usage: $0 build|run [-e=env-file ] [-a|-t]";
echo "Usage: composer build-and-run -- [-a|-t]";
echo " -a Spin up a WordPress installation.";
echo " -t Run the automated tests.";
exit 1
}
@@ -62,6 +70,7 @@ case "$subcommand" in
-e COVERAGE=${COVERAGE-} \
-e DEBUG=${DEBUG-} \
-e SKIP_TESTS_CLEANUP=${SKIP_TESTS_CLEANUP-} \
-e LOWEST=${LOWEST-} \
testing --scale app=0
;;
\? ) print_usage_instructions;;
+5 -6
View File
@@ -21,7 +21,7 @@
}
],
"require": {
"php": ">=5.6.0",
"php": ">=7.1.0",
"firebase/php-jwt": "^5.0"
},
"require-dev": {
@@ -57,14 +57,13 @@
"docker-run": "bash bin/run-docker.sh run",
"docker-destroy": "docker-compose down",
"build-and-run": [
"Composer\\Config::disableProcessTimeout",
"@docker-build",
"@docker-run"
],
"build-local-app": "@docker-build -a",
"build-local-test": "@docker-build -t",
"run-local-app": "@docker-run -a",
"run-local-test": "@docker-run -t",
"build-app": "@docker-build -a",
"build-test": "@docker-build -t",
"run-app": "@docker-run -a",
"run-test": "@docker-run -t",
"lint": "vendor/bin/phpcs"
},
"support" : {
+5
View File
@@ -66,7 +66,12 @@ if [ ! -f "$PROJECT_DIR/c3.php" ]; then
curl -L 'https://raw.github.com/Codeception/c3/2.0/c3.php' > "$PROJECT_DIR/c3.php"
fi
if [[ -n "$LOWEST" ]]; then
PREFER_LOWEST="--prefer-source"
fi
# Install dependencies
COMPOSER_MEMORY_LIMIT=-1 composer update --prefer-source ${PREFER_LOWEST}
COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-source --no-interaction
# Install pcov/clobber if PHP7.1+
-3
View File
@@ -44,9 +44,6 @@ class IntrospectionQueryTest extends \Codeception\TestCase\WPTestCase {
$query = \GraphQL\Type\Introspection::getIntrospectionQuery();
$results = graphql( array( 'query' => $query ) );
// use --debug flag to view.
codecept_debug( $results );
$this->assertArrayNotHasKey('errors', $results );
}
}
+1 -1
View File
@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991::getLoader();
return ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5::getLoader();
+7 -7
View File
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991
class ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5
{
private static $loader;
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit8f9529f1e65fdb8a7b8596df063296d5', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit2fa8cc4089933233a2ec1576fa073991
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire2fa8cc4089933233a2ec1576fa073991($fileIdentifier, $file);
composerRequire8f9529f1e65fdb8a7b8596df063296d5($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire2fa8cc4089933233a2ec1576fa073991($fileIdentifier, $file)
function composerRequire8f9529f1e65fdb8a7b8596df063296d5($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
+4 -4
View File
@@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit2fa8cc4089933233a2ec1576fa073991
class ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5
{
public static $files = array (
'944484f100dc1864a5320474d49ebd5a' => __DIR__ . '/../..' . '/includes/connection/wc-cpt-connection-args.php',
@@ -176,9 +176,9 @@ class ComposerStaticInit2fa8cc4089933233a2ec1576fa073991
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2fa8cc4089933233a2ec1576fa073991::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8f9529f1e65fdb8a7b8596df063296d5::$classMap;
}, null, ClassLoader::class);
}