From 048822536f5126e1848b60b7466e9025fb20770b Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:04:40 -0500 Subject: [PATCH 01/36] Workflow created. --- .github/workflows/ci-workflow.yml | 98 +++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/ci-workflow.yml diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml new file mode 100644 index 000000000..ba3a2bba1 --- /dev/null +++ b/.github/workflows/ci-workflow.yml @@ -0,0 +1,98 @@ +name: CI Workflow + +on: + push: + branches: + - develop + - master + pull_request: + branches: + - develop + +jobs: + testing: + runs-on: ubuntu-latest + strategy: + matrix: + coverage: 0 + debug: 0 + php: [7.3, 7.2, 7.1, 7.0, 5.6] + wordpress: [5.3, 5.0, 4.9] + include: + - php: 5.6 + wordpress: 5.3 + phpcs: 1 + include: + - php: 7.0 + wordpress: 5.0 + coverage: 1 + exclude: + - php: 7.3 + wordpress: 4.9 + exclude: + - php: 7.2 + wordpress: 4.9 + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Docker-Compose Up + if: matrix.phpcs != 1 + run: | + docker-compose build \ + --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} \ + --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} \ + --build-arg USE_XDEBUG=${{ matrix.xdebug }} \ + testing + + - name: Run Tests with Docker + if: matrix.phpcs != 1 + run: | + docker-compose run --rm \ + -e COVERAGE=${matrix.coverage:-0} \ + -e DEBUG=${matrix.debug:-0} \ + testing --scale app=0 + + - name: Setup PHP + if: matrix.phpcs == 1 + uses: shivammathur/setup-php@v1 + php-version: ${{ matrix.php }} + + - name: Get Composer Cache Directory + if: matrix.phpcs == 1 + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + if: matrix.phpcs == 1 + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer + + - name: Install dependencies + if: matrix.phpcs == 1 + run: | + composer require \ + squizlabs/php_codesniffer \ + phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \ + dealerdirect/phpcodesniffer-composer-installer + composer install --no-dev + + - name: Run PHP CodeSniffer + if: matrix.phpcs == 1 + run: | + vendor/bin/phpcs \ + wp-graphql-woocommerce.php \ + access-functions.php \ + class-inflect.php \ + includes/*.php --standard=WordPress + + - name: Push Codecoverage to Coveralls.io + if: matrix.coverage == 1 + run: | + wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar + chmod +x php-coveralls.phar + + php php-coveralls.phar -v \ No newline at end of file From b7b0db4fdcb7513971f34396c8558567748e8326 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:12:39 -0500 Subject: [PATCH 02/36] syntax error fixed --- .github/workflows/ci-workflow.yml | 114 +++++++++++++++--------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index ba3a2bba1..fe090d489 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -32,67 +32,67 @@ jobs: exclude: - php: 7.2 wordpress: 4.9 - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Docker-Compose Up - if: matrix.phpcs != 1 - run: | - docker-compose build \ - --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} \ - --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} \ - --build-arg USE_XDEBUG=${{ matrix.xdebug }} \ - testing + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Docker-Compose Up + if: matrix.phpcs != 1 + run: | + docker-compose build \ + --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} \ + --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} \ + --build-arg USE_XDEBUG=${{ matrix.xdebug }} \ + testing - - name: Run Tests with Docker - if: matrix.phpcs != 1 - run: | - docker-compose run --rm \ - -e COVERAGE=${matrix.coverage:-0} \ - -e DEBUG=${matrix.debug:-0} \ - testing --scale app=0 + - name: Run Tests with Docker + if: matrix.phpcs != 1 + run: | + docker-compose run --rm \ + -e COVERAGE=${matrix.coverage:-0} \ + -e DEBUG=${matrix.debug:-0} \ + testing --scale app=0 - - name: Setup PHP - if: matrix.phpcs == 1 - uses: shivammathur/setup-php@v1 - php-version: ${{ matrix.php }} + - name: Setup PHP + if: matrix.phpcs == 1 + uses: shivammathur/setup-php@v1 + php-version: ${{ matrix.php }} - - name: Get Composer Cache Directory - if: matrix.phpcs == 1 - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Get Composer Cache Directory + if: matrix.phpcs == 1 + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache dependencies - if: matrix.phpcs == 1 - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer + - name: Cache dependencies + if: matrix.phpcs == 1 + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer - - name: Install dependencies - if: matrix.phpcs == 1 - run: | - composer require \ - squizlabs/php_codesniffer \ - phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \ - dealerdirect/phpcodesniffer-composer-installer - composer install --no-dev + - name: Install dependencies + if: matrix.phpcs == 1 + run: | + composer require \ + squizlabs/php_codesniffer \ + phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \ + dealerdirect/phpcodesniffer-composer-installer + composer install --no-dev - - name: Run PHP CodeSniffer - if: matrix.phpcs == 1 - run: | - vendor/bin/phpcs \ - wp-graphql-woocommerce.php \ - access-functions.php \ - class-inflect.php \ - includes/*.php --standard=WordPress - - - name: Push Codecoverage to Coveralls.io - if: matrix.coverage == 1 - run: | - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - chmod +x php-coveralls.phar + - name: Run PHP CodeSniffer + if: matrix.phpcs == 1 + run: | + vendor/bin/phpcs \ + wp-graphql-woocommerce.php \ + access-functions.php \ + class-inflect.php \ + includes/*.php --standard=WordPress - php php-coveralls.phar -v \ No newline at end of file + - name: Push Codecoverage to Coveralls.io + if: matrix.coverage == 1 + run: | + wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar + chmod +x php-coveralls.phar + + php php-coveralls.phar -v \ No newline at end of file From 884e184bcb30ebd03974ec63562c054802af0b1b Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:14:52 -0500 Subject: [PATCH 03/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index fe090d489..ab58b5726 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -12,10 +12,11 @@ on: jobs: testing: runs-on: ubuntu-latest + env: + coverage: 0 + debug: 0 strategy: matrix: - coverage: 0 - debug: 0 php: [7.3, 7.2, 7.1, 7.0, 5.6] wordpress: [5.3, 5.0, 4.9] include: From a1c39ca4973307d930754c2be62df7be31add84c Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:16:56 -0500 Subject: [PATCH 04/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index ab58b5726..f0d1a5137 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -23,14 +23,15 @@ jobs: - php: 5.6 wordpress: 5.3 phpcs: 1 - include: + - php: 7.0 wordpress: 5.0 coverage: 1 + exclude: - php: 7.3 wordpress: 4.9 - exclude: + - php: 7.2 wordpress: 4.9 steps: From 058c57d555159c9ac820e1fda9dc0d42ce6d2ef5 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:20:28 -0500 Subject: [PATCH 05/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index f0d1a5137..d797db1ba 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -58,7 +58,9 @@ jobs: - name: Setup PHP if: matrix.phpcs == 1 uses: shivammathur/setup-php@v1 - php-version: ${{ matrix.php }} + with: + php-version: ${{ matrix.php }} + tools: composer - name: Get Composer Cache Directory if: matrix.phpcs == 1 From 3fdb85c8f84f77fd5035f242ab28aa083ac75b19 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:22:27 -0500 Subject: [PATCH 06/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index d797db1ba..b1398c2bc 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -17,23 +17,23 @@ jobs: debug: 0 strategy: matrix: - php: [7.3, 7.2, 7.1, 7.0, 5.6] - wordpress: [5.3, 5.0, 4.9] + php: ['7.3', '7.2', '7.1', '7.0', '5.6'] + wordpress: ['5.3', '5.0', '4.9'] include: - - php: 5.6 - wordpress: 5.3 + - php: '5.6' + wordpress: '5.3' phpcs: 1 - - php: 7.0 - wordpress: 5.0 + - php: '7.0' + wordpress: '5.0' coverage: 1 exclude: - - php: 7.3 - wordpress: 4.9 + - php: '7.3' + wordpress: '4.9' - - php: 7.2 - wordpress: 4.9 + - php: '7.2' + wordpress: '4.9' steps: - name: Checkout uses: actions/checkout@v1 From c61e0b7a277a322254baf3075d99b32e2aa8b40a Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:45:47 -0500 Subject: [PATCH 07/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index b1398c2bc..eccabe41c 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -37,24 +37,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v1 - - - name: Docker-Compose Up - if: matrix.phpcs != 1 - run: | - docker-compose build \ - --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} \ - --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} \ - --build-arg USE_XDEBUG=${{ matrix.xdebug }} \ - testing - - name: Run Tests with Docker + - name: Build Docker Images and run tests if: matrix.phpcs != 1 run: | - docker-compose run --rm \ + DESIRED_PHP_VERSION=${{ matrix.php }} \ + DESIRED_WP_VERSION=${{ matrix.wordpress } \ + docker-compose run --rm -d \ -e COVERAGE=${matrix.coverage:-0} \ -e DEBUG=${matrix.debug:-0} \ testing --scale app=0 + - name: "Print Docker Logs" + if: matrix.phpcs != 1 + run: docker-compose logs + - name: Setup PHP if: matrix.phpcs == 1 uses: shivammathur/setup-php@v1 From 33ffa7c056a7adb48741c2edaf013e2afab807ce Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:46:37 -0500 Subject: [PATCH 08/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index eccabe41c..24dc477bf 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -41,8 +41,8 @@ jobs: - name: Build Docker Images and run tests if: matrix.phpcs != 1 run: | - DESIRED_PHP_VERSION=${{ matrix.php }} \ - DESIRED_WP_VERSION=${{ matrix.wordpress } \ + PHP_VERSION=${{ matrix.php }} \ + WP_VERSION=${{ matrix.wordpress } \ docker-compose run --rm -d \ -e COVERAGE=${matrix.coverage:-0} \ -e DEBUG=${matrix.debug:-0} \ From f2583f061e0c3b7a3368926e09f87e31feab0cbf Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:56:05 -0500 Subject: [PATCH 09/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 2 +- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++++------- vendor/composer/autoload_static.php | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 24dc477bf..73cdc7de5 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -42,7 +42,7 @@ jobs: if: matrix.phpcs != 1 run: | PHP_VERSION=${{ matrix.php }} \ - WP_VERSION=${{ matrix.wordpress } \ + WP_VERSION=${{ matrix.wordpress }} \ docker-compose run --rm -d \ -e COVERAGE=${matrix.coverage:-0} \ -e DEBUG=${matrix.debug:-0} \ diff --git a/vendor/autoload.php b/vendor/autoload.php index 156abf9cd..1530b2952 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitcab7a6a7239ac8af7f5a764eb6b56ee1::getLoader(); +return ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 677e21cc7..81278391c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitcab7a6a7239ac8af7f5a764eb6b56ee1 +class ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9 { private static $loader; @@ -19,15 +19,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitcab7a6a7239ac8af7f5a764eb6b56ee1', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitcab7a6a7239ac8af7f5a764eb6b56ee1', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9', '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\ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirecab7a6a7239ac8af7f5a764eb6b56ee1($fileIdentifier, $file); + composerRequireea8d5368c9ddcbe5b88bdef7b5101ce9($fileIdentifier, $file); } return $loader; } } -function composerRequirecab7a6a7239ac8af7f5a764eb6b56ee1($fileIdentifier, $file) +function composerRequireea8d5368c9ddcbe5b88bdef7b5101ce9($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 96c787a5e..dbab3de01 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1 +class ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9 { public static $files = array ( '914b07b8cf678ed0b81bfdb5d23b4f2b' => __DIR__ . '/../..' . '/includes/connection/common-post-type-args.php', @@ -171,9 +171,9 @@ class ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitcab7a6a7239ac8af7f5a764eb6b56ee1::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$classMap; }, null, ClassLoader::class); } From 9a7da73e3a8c175e0d40ebdc8c919dc7593d2076 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 00:57:47 -0500 Subject: [PATCH 10/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 73cdc7de5..915408a84 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -44,8 +44,8 @@ jobs: PHP_VERSION=${{ matrix.php }} \ WP_VERSION=${{ matrix.wordpress }} \ docker-compose run --rm -d \ - -e COVERAGE=${matrix.coverage:-0} \ - -e DEBUG=${matrix.debug:-0} \ + -e COVERAGE=${{ matrix.coverage }} \ + -e DEBUG=${{ matrix.debug }} \ testing --scale app=0 - name: "Print Docker Logs" From 3128c00d762a35570bd77fd49d6d1370a658d9f1 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 01:05:49 -0500 Subject: [PATCH 11/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 915408a84..a245476e2 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -10,7 +10,7 @@ on: - develop jobs: - testing: + run: runs-on: ubuntu-latest env: coverage: 0 @@ -34,6 +34,7 @@ jobs: - php: '7.2' wordpress: '4.9' + name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }} steps: - name: Checkout uses: actions/checkout@v1 From 7ccbafeebe324c61a0daf2a6a40d0195c94cb73c Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 01:22:33 -0500 Subject: [PATCH 12/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index a245476e2..24484cff1 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -42,8 +42,8 @@ jobs: - name: Build Docker Images and run tests if: matrix.phpcs != 1 run: | - PHP_VERSION=${{ matrix.php }} \ - WP_VERSION=${{ matrix.wordpress }} \ + export PHP_VERSION=${{ matrix.php }} + export WP_VERSION=${{ matrix.wordpress }} docker-compose run --rm -d \ -e COVERAGE=${{ matrix.coverage }} \ -e DEBUG=${{ matrix.debug }} \ From 62163fd66e43b180b82c9597f603107557cab2a9 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 01:23:58 -0500 Subject: [PATCH 13/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 24484cff1..e20aa9754 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -42,8 +42,8 @@ jobs: - name: Build Docker Images and run tests if: matrix.phpcs != 1 run: | - export PHP_VERSION=${{ matrix.php }} - export WP_VERSION=${{ matrix.wordpress }} + export DESIRED_PHP_VERSION=${{ matrix.php }} + export DESIRED_WP_VERSION=${{ matrix.wordpress }} docker-compose run --rm -d \ -e COVERAGE=${{ matrix.coverage }} \ -e DEBUG=${{ matrix.debug }} \ From c98d749dc7b26f0bd0eaac1283b05640f3cd9cf3 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Sun, 16 Feb 2020 01:28:12 -0500 Subject: [PATCH 14/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index e20aa9754..92e6ca08f 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -42,8 +42,8 @@ jobs: - name: Build Docker Images and run tests if: matrix.phpcs != 1 run: | - export DESIRED_PHP_VERSION=${{ matrix.php }} - export DESIRED_WP_VERSION=${{ matrix.wordpress }} + export PHP_VERSION=${{ matrix.php }} + export WP_VERSION=${{ matrix.wordpress }} docker-compose run --rm -d \ -e COVERAGE=${{ matrix.coverage }} \ -e DEBUG=${{ matrix.debug }} \ @@ -58,6 +58,7 @@ jobs: uses: shivammathur/setup-php@v1 with: php-version: ${{ matrix.php }} + extensions: mbstring, intl tools: composer - name: Get Composer Cache Directory From 92448bc08a97fed8f388d0afaa402dd421c36e00 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 17 Feb 2020 23:27:56 -0500 Subject: [PATCH 15/36] ci-workflow updated. --- .github/workflows/ci-workflow.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 92e6ca08f..a308a5dff 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -39,15 +39,13 @@ jobs: - name: Checkout uses: actions/checkout@v1 - - name: Build Docker Images and run tests + - name: Build Docker Network + if: matrix.phpcs !=1 + run: docker-compose build --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} testing + + - name: Run tests if: matrix.phpcs != 1 - run: | - export PHP_VERSION=${{ matrix.php }} - export WP_VERSION=${{ matrix.wordpress }} - docker-compose run --rm -d \ - -e COVERAGE=${{ matrix.coverage }} \ - -e DEBUG=${{ matrix.debug }} \ - testing --scale app=0 + run: docker-compose run --rm -d -e COVERAGE=${{ matrix.coverage }} -e DEBUG=${{ matrix.debug }} testing --scale app=0 - name: "Print Docker Logs" if: matrix.phpcs != 1 From 42c0519bf6a7792e79caef148871c4f0fee4dc44 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 15:38:33 -0500 Subject: [PATCH 16/36] cs-workflow created --- .github/workflows/ci-workflow.yml | 50 ++--------------------------- .github/workflows/cs-workflow.yml | 52 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/cs-workflow.yml diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index a308a5dff..94db32e33 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -17,13 +17,9 @@ jobs: debug: 0 strategy: matrix: - php: ['7.3', '7.2', '7.1', '7.0', '5.6'] + php: ['7.3', '7.2', '7.1', '7.0'] wordpress: ['5.3', '5.0', '4.9'] - include: - - php: '5.6' - wordpress: '5.3' - phpcs: 1 - + include: - php: '7.0' wordpress: '5.0' coverage: 1 @@ -40,55 +36,13 @@ jobs: uses: actions/checkout@v1 - name: Build Docker Network - if: matrix.phpcs !=1 run: docker-compose build --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} testing - name: Run tests - if: matrix.phpcs != 1 run: docker-compose run --rm -d -e COVERAGE=${{ matrix.coverage }} -e DEBUG=${{ matrix.debug }} testing --scale app=0 - name: "Print Docker Logs" - if: matrix.phpcs != 1 run: docker-compose logs - - - name: Setup PHP - if: matrix.phpcs == 1 - uses: shivammathur/setup-php@v1 - with: - php-version: ${{ matrix.php }} - extensions: mbstring, intl - tools: composer - - - name: Get Composer Cache Directory - if: matrix.phpcs == 1 - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - if: matrix.phpcs == 1 - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer - - - name: Install dependencies - if: matrix.phpcs == 1 - run: | - composer require \ - squizlabs/php_codesniffer \ - phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \ - dealerdirect/phpcodesniffer-composer-installer - composer install --no-dev - - - name: Run PHP CodeSniffer - if: matrix.phpcs == 1 - run: | - vendor/bin/phpcs \ - wp-graphql-woocommerce.php \ - access-functions.php \ - class-inflect.php \ - includes/*.php --standard=WordPress - name: Push Codecoverage to Coveralls.io if: matrix.coverage == 1 diff --git a/.github/workflows/cs-workflow.yml b/.github/workflows/cs-workflow.yml new file mode 100644 index 000000000..d44721377 --- /dev/null +++ b/.github/workflows/cs-workflow.yml @@ -0,0 +1,52 @@ +name: Coding Standards Workflow + +on: + push: + branches: + - develop + - master + pull_request: + branches: + - develop + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Setup PHP + if: matrix.phpcs == 1 + uses: shivammathur/setup-php@v1 + with: + php-version: 7.3 + extensions: mbstring, intl + tools: composer + + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer + + - name: Install dependencies + run: | + composer require \ + squizlabs/php_codesniffer \ + phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \ + dealerdirect/phpcodesniffer-composer-installer + composer install --no-dev + + - name: Run PHP CodeSniffer + run: | + vendor/bin/phpcs \ + wp-graphql-woocommerce.php \ + access-functions.php \ + class-inflect.php \ + includes/*.php --standard=WordPress \ No newline at end of file From 465990e096a723a50f8d2f4ed43bd187d3dcab95 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 15:42:23 -0500 Subject: [PATCH 17/36] cs-workflow created --- .github/workflows/cs-workflow.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cs-workflow.yml b/.github/workflows/cs-workflow.yml index d44721377..432937ed0 100644 --- a/.github/workflows/cs-workflow.yml +++ b/.github/workflows/cs-workflow.yml @@ -28,13 +28,6 @@ jobs: id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer - - name: Install dependencies run: | composer require \ @@ -43,6 +36,13 @@ jobs: dealerdirect/phpcodesniffer-composer-installer composer install --no-dev + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer + - name: Run PHP CodeSniffer run: | vendor/bin/phpcs \ From f326bef027650f2124ebf35d29e09979ba8f4d45 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 15:44:33 -0500 Subject: [PATCH 18/36] syntax error fixed --- .github/workflows/cs-workflow.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cs-workflow.yml b/.github/workflows/cs-workflow.yml index 432937ed0..bfc96f1af 100644 --- a/.github/workflows/cs-workflow.yml +++ b/.github/workflows/cs-workflow.yml @@ -39,9 +39,9 @@ jobs: - name: Cache dependencies uses: actions/cache@v1 with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer - name: Run PHP CodeSniffer run: | From 90b96299f256f942bb87e45cc05f45c7f935dfac Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 16:09:43 -0500 Subject: [PATCH 19/36] .travis.yml updated --- .github/workflows/ci-workflow.yml | 16 +++++----- .travis.yml | 50 +++++++------------------------ 2 files changed, 18 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 94db32e33..ae397011a 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -1,13 +1,13 @@ name: CI Workflow -on: - push: - branches: - - develop - - master - pull_request: - branches: - - develop +# on: +# push: +# branches: +# - develop +# - master +# pull_request: +# branches: +# - develop jobs: run: diff --git a/.travis.yml b/.travis.yml index 2e7c43503..01d3bdef5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,6 @@ matrix: include: - php: 7.3 env: PHP_VERSION=7.3 WP_VERSION=5.3 - - php: 7.3 - env: PHP_VERSION=7.3 PHPCS=1 - php: 7.2 env: PHP_VERSION=7.2 WP_VERSION=5.3 - php: 7.2 @@ -60,50 +58,22 @@ before_install: echo "xdebug.ini does not exist" fi -install: - - | - cd $TRAVIS_BUILD_DIR - curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar - chmod +x wp-cli.phar - sudo mv wp-cli.phar /usr/local/bin/wp - before_script: - | - if [ ! -z "$WP_VERSION" ]; then - # Build images. - docker-compose build \ - --build-arg DESIRED_PHP_VERSION=${PHP_VERSION} \ - --build-arg DESIRED_WP_VERSION=${WP_VERSION} \ - --build-arg USE_XDEBUG=${USE_XDEBUG} \ - testing - fi - # Install PHP CodeSniffer and WPCS. - - | - if [ "$PHPCS" == "1" ]; then - COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require \ - squizlabs/php_codesniffer \ - phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \ - dealerdirect/phpcodesniffer-composer-installer - COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --no-dev - fi + # Build images. + docker-compose build \ + --build-arg DESIRED_PHP_VERSION=${PHP_VERSION} \ + --build-arg DESIRED_WP_VERSION=${WP_VERSION} \ + --build-arg USE_XDEBUG=${USE_XDEBUG} \ + testing script: # Execute unit tests with coverage if specified, otherwise without coverage - | - if [ ! -z "$WP_VERSION" ]; then - docker-compose run --rm \ - -e COVERAGE=${COVERAGE:-0} \ - -e DEBUG=${DEBUG:-0} \ - testing --scale app=0 - fi - - | - if [ "$PHPCS" == "1" ]; then - vendor/bin/phpcs \ - wp-graphql-woocommerce.php \ - access-functions.php \ - class-inflect.php \ - includes/*.php --standard=WordPress - fi + docker-compose run --rm \ + -e COVERAGE=${COVERAGE:-0} \ + -e DEBUG=${DEBUG:-0} \ + testing --scale app=0 after_success: # Download and run Coveralls.io client - | From e1a5b7ed58ffa8eff7d999aaec7e7b382896b748 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 16:32:41 -0500 Subject: [PATCH 20/36] workflows renamed. --- ...i-workflow.yml => testing-integration.yml} | 31 +++++++++---------- ...flow.yml => wordpress-coding-standard.yml} | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) rename .github/workflows/{ci-workflow.yml => testing-integration.yml} (63%) rename .github/workflows/{cs-workflow.yml => wordpress-coding-standard.yml} (97%) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/testing-integration.yml similarity index 63% rename from .github/workflows/ci-workflow.yml rename to .github/workflows/testing-integration.yml index ae397011a..08a8e1b3c 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/testing-integration.yml @@ -1,13 +1,13 @@ -name: CI Workflow +name: Testing Integration -# on: -# push: -# branches: -# - develop -# - master -# pull_request: -# branches: -# - develop +on: + push: + branches: + - develop + - master + pull_request: + branches: + - develop jobs: run: @@ -36,13 +36,12 @@ jobs: uses: actions/checkout@v1 - name: Build Docker Network - run: docker-compose build --build-arg DESIRED_PHP_VERSION=${{ matrix.php }} --build-arg DESIRED_WP_VERSION=${{ matrix.wordpress }} testing - - - name: Run tests - run: docker-compose run --rm -d -e COVERAGE=${{ matrix.coverage }} -e DEBUG=${{ matrix.debug }} testing --scale app=0 - - - name: "Print Docker Logs" - run: docker-compose logs + run: | + PHP_VERSION=${{ matrix.php }} \ + WP_VERSION=${{ matrix.wordpress }} \ + COVERAGE=${{ matrix.coverage }} \ + DEBUG=${{ matrix.debug }} \ + docker-compose up --exit-code-from testing --scale app=0 - name: Push Codecoverage to Coveralls.io if: matrix.coverage == 1 diff --git a/.github/workflows/cs-workflow.yml b/.github/workflows/wordpress-coding-standard.yml similarity index 97% rename from .github/workflows/cs-workflow.yml rename to .github/workflows/wordpress-coding-standard.yml index bfc96f1af..8bbea856e 100644 --- a/.github/workflows/cs-workflow.yml +++ b/.github/workflows/wordpress-coding-standard.yml @@ -1,4 +1,4 @@ -name: Coding Standards Workflow +name: WordPress Coding Standards on: push: From cc72749249f4a65b488cbafee99916bd69cc6754 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 16:39:13 -0500 Subject: [PATCH 21/36] testing-integration workflow updated. --- .github/workflows/testing-integration.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index 08a8e1b3c..6d4f0558a 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -27,9 +27,11 @@ jobs: exclude: - php: '7.3' wordpress: '4.9' - - php: '7.2' wordpress: '4.9' + - php: '7.0' + wordpress: '5.3' + fail-fast: false name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }} steps: - name: Checkout From 5979dfd3b9c7c7e1fe034284fead23984f0a8418 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 16:57:22 -0500 Subject: [PATCH 22/36] Dockerfile updated. --- Dockerfile | 4 ++-- docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 332ef179b..225634fe9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ ############################################################################ # Using the 'DESIRED_' prefix to avoid confusion with environment variables of the same name. -ARG DESIRED_WP_VERSION -ARG DESIRED_PHP_VERSION +ARG DESIRED_WP_VERSION=${PHP_VERSION:-7.3} +ARG DESIRED_PHP_VERSION=${WP_VERSION:-5.2} FROM kidunot89/woographql-app:wp${DESIRED_WP_VERSION}-php${DESIRED_PHP_VERSION} diff --git a/docker-compose.yml b/docker-compose.yml index c96956927..303074ac3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,8 +41,8 @@ services: context: . dockerfile: Dockerfile args: - - DESIRED_PHP_VERSION="${PHP_VERSION:-7.3}" - - DESIRED_WP_VERSION="${WP_VERSION:-5.2}" + - DESIRED_PHP_VERSION + - DESIRED_WP_VERSION - USE_XDEBUG image: woographql-testing volumes: From e2a15a64bcee8a5af87a03122626265cb14b8ce2 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 17:10:11 -0500 Subject: [PATCH 23/36] Dockerfile updated. --- Dockerfile | 14 +++++++------- docker-compose.yml | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 225634fe9..e5808832e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,10 @@ ############################################################################ # Using the 'DESIRED_' prefix to avoid confusion with environment variables of the same name. -ARG DESIRED_WP_VERSION=${PHP_VERSION:-7.3} -ARG DESIRED_PHP_VERSION=${WP_VERSION:-5.2} +ARG WP_VERSION +ARG PHP_VERSION -FROM kidunot89/woographql-app:wp${DESIRED_WP_VERSION}-php${DESIRED_PHP_VERSION} +FROM kidunot89/woographql-app:wp${WP_VERSION}-php${PHP_VERSION} LABEL author=kidunot89 @@ -15,11 +15,11 @@ LABEL author_uri=https://github.com/kidunot89 SHELL [ "/bin/bash", "-c" ] # Redeclare ARGs and set as environmental variables for reuse. -ARG DESIRED_WP_VERSION -ARG DESIRED_PHP_VERSION +ARG WP_VERSION +ARG PHP_VERSION ARG USE_XDEBUG -ENV WP_VERSION=${DESIRED_WP_VERSION} -ENV PHP_VERSION=${DESIRED_PHP_VERSION} +ENV WP_VERSION=${WP_VERSION} +ENV PHP_VERSION=${PHP_VERSION} ENV USING_XDEBUG=${USE_XDEBUG} # Install php extensions diff --git a/docker-compose.yml b/docker-compose.yml index 303074ac3..05c2189d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,8 +41,8 @@ services: context: . dockerfile: Dockerfile args: - - DESIRED_PHP_VERSION - - DESIRED_WP_VERSION + - PHP_VERSION="${PHP_VERSION:-7.3}" + - WP_VERSION="${WP_VERSION:-5.2}" - USE_XDEBUG image: woographql-testing volumes: From 2634ba6431e74b84d30538f1015c72a32d718c89 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 17:26:44 -0500 Subject: [PATCH 24/36] Dockerfile updated. --- .github/workflows/testing-integration.yml | 2 +- .travis.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index 6d4f0558a..199c449c2 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -43,7 +43,7 @@ jobs: WP_VERSION=${{ matrix.wordpress }} \ COVERAGE=${{ matrix.coverage }} \ DEBUG=${{ matrix.debug }} \ - docker-compose up --exit-code-from testing --scale app=0 + docker-compose up --build --exit-code-from testing --scale app=0 - name: Push Codecoverage to Coveralls.io if: matrix.coverage == 1 diff --git a/.travis.yml b/.travis.yml index 01d3bdef5..2efe7edc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,8 +62,8 @@ before_script: - | # Build images. docker-compose build \ - --build-arg DESIRED_PHP_VERSION=${PHP_VERSION} \ - --build-arg DESIRED_WP_VERSION=${WP_VERSION} \ + --build-arg PHP_VERSION=${PHP_VERSION} \ + --build-arg WP_VERSION=${WP_VERSION} \ --build-arg USE_XDEBUG=${USE_XDEBUG} \ testing From 17e06471f534de35848adf7af0a3b8ea4b9da978 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 17:40:04 -0500 Subject: [PATCH 25/36] testing-integration workflow updated. --- .github/workflows/testing-integration.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index 199c449c2..671ba2adb 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -23,6 +23,7 @@ jobs: - php: '7.0' wordpress: '5.0' coverage: 1 + use_xdebug: 1 exclude: - php: '7.3' @@ -37,13 +38,20 @@ jobs: - name: Checkout uses: actions/checkout@v1 - - name: Build Docker Network + - name: Build "testing" Docker Image run: | - PHP_VERSION=${{ matrix.php }} \ - WP_VERSION=${{ matrix.wordpress }} \ - COVERAGE=${{ matrix.coverage }} \ - DEBUG=${{ matrix.debug }} \ - docker-compose up --build --exit-code-from testing --scale app=0 + docker-compose build \ + --build-arg PHP_VERSION=${{ matrix.php }} \ + --build-arg WP_VERSION=${{ matrix.wordpress }} \ + --build-arg USE_XDEBUG=${{ matrix.use_xdebug }} \ + testing + + - name: Run Tests w/ Docker. + run: | + docker-compose run --rm \ + -e COVERAGE=${{ matrix.coverage }} \ + -e DEBUG=${{ matrix.debug }} \ + testing --scale app=0 - name: Push Codecoverage to Coveralls.io if: matrix.coverage == 1 From 1a4b82cd6f9f9f19fb7ebdeeb5cabf48b8a14d98 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 17:55:24 -0500 Subject: [PATCH 26/36] testing-integration workflow updated. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e5808832e..f1526adbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN if [ "$PHP_VERSION" != "5.6" ] && [ "$PHP_VERSION" != "7.0" ] && [[ -z "$USI && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini; \ - elif [ "$PHP_VERSION" == "7.0" ]; then \ + elif [ "$PHP_VERSION" == "7.0" ] || [ ! -z "$USING_XDEBUG" ]; then \ yes | pecl install xdebug-2.6.1 \ && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ From f0886274c9ca9b1c2e066f8bdddc36fa4f4ffd1b Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 18:00:58 -0500 Subject: [PATCH 27/36] testing-integration workflow updated. --- .github/workflows/testing-integration.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index 671ba2adb..96a8aba78 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -20,10 +20,11 @@ jobs: php: ['7.3', '7.2', '7.1', '7.0'] wordpress: ['5.3', '5.0', '4.9'] include: + - php: '7.0' + use_xdebug: 1 - php: '7.0' wordpress: '5.0' coverage: 1 - use_xdebug: 1 exclude: - php: '7.3' From 59fcb878a804f32790f2c86a56790df394f4510e Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 18:23:21 -0500 Subject: [PATCH 28/36] .travis.yml removed --- .travis.yml | 85 ----------------------------------------------------- README.md | 2 +- 2 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2efe7edc1..000000000 --- a/.travis.yml +++ /dev/null @@ -1,85 +0,0 @@ -sudo: false -dist: trusty - -language: php - -services: - - docker - -notifications: - email: - on_success: never - on_failure: never - -branches: - only: - - develop - - master - -cache: - apt: true - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 7.3 - env: PHP_VERSION=7.3 WP_VERSION=5.3 - - php: 7.2 - env: PHP_VERSION=7.2 WP_VERSION=5.3 - - php: 7.2 - env: PHP_VERSION=7.2 WP_VERSION=4.9 - - php: 7.1 - env: PHP_VERSION=7.1 WP_VERSION=5.3 - - php: 7.1 - env: PHP_VERSION=7.1 WP_VERSION=4.9 - - php: 7.0 - env: PHP_VERSION=7.0 WP_VERSION=5.0 COVERAGE=1 - - php: 7.0 - env: PHP_VERSION=7.0 WP_VERSION=4.9 - - php: 5.6 - env: PHP_VERSION=5.6 WP_VERSION=5.0 - - php: 5.6 - env: PHP_VERSION=5.6 WP_VERSION=4.9 - allow_failures: - - env: PHP_VERSION=5.6 WP_VERSION=5.0 - - env: PHP_VERSION=5.6 WP_VERSION=4.9 - -before_install: - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - | - # Remove Xdebug for a huge performance increase: - if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then - phpenv config-rm xdebug.ini - else - echo "xdebug.ini does not exist" - fi - -before_script: - - | - # Build images. - docker-compose build \ - --build-arg PHP_VERSION=${PHP_VERSION} \ - --build-arg WP_VERSION=${WP_VERSION} \ - --build-arg USE_XDEBUG=${USE_XDEBUG} \ - testing - -script: - # Execute unit tests with coverage if specified, otherwise without coverage - - | - docker-compose run --rm \ - -e COVERAGE=${COVERAGE:-0} \ - -e DEBUG=${DEBUG:-0} \ - testing --scale app=0 -after_success: - # Download and run Coveralls.io client - - | - if [ "$COVERAGE" == "1" ]; then - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - chmod +x php-coveralls.phar - - travis_retry php php-coveralls.phar -v - fi diff --git a/README.md b/README.md index 32ab4a0fc..269a17465 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ DocsAxisTaylor • Join Slack -[![Build Status](https://travis-ci.org/wp-graphql/wp-graphql-woocommerce.svg?branch=develop)](https://travis-ci.org/wp-graphql/wp-graphql-woocommerce) [![Coverage Status](https://coveralls.io/repos/github/wp-graphql/wp-graphql-woocommerce/badge.svg?branch=develop)](https://coveralls.io/github/wp-graphql/wp-graphql-woocommerce?branch=develop) +[![Actions Status](https://github.com/wp-graphql/wp-graphql-woocommerce/workflows/testing-integration/badge.svg)](https://github.com/wp-graphql/wp-graphql-woocommerce/actions)[![Coverage Status](https://coveralls.io/repos/github/wp-graphql/wp-graphql-woocommerce/badge.svg?branch=develop)](https://coveralls.io/github/wp-graphql/wp-graphql-woocommerce?branch=develop) ## Quick Install 1. Install & activate [WooCommerce](https://woocommerce.com/) From c1e4363a330a62bafe2490f815614a8a64d76b38 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 18:26:17 -0500 Subject: [PATCH 29/36] README.md updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 269a17465..17e25b150 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ DocsAxisTaylor • Join Slack -[![Actions Status](https://github.com/wp-graphql/wp-graphql-woocommerce/workflows/testing-integration/badge.svg)](https://github.com/wp-graphql/wp-graphql-woocommerce/actions)[![Coverage Status](https://coveralls.io/repos/github/wp-graphql/wp-graphql-woocommerce/badge.svg?branch=develop)](https://coveralls.io/github/wp-graphql/wp-graphql-woocommerce?branch=develop) +[![Actions Status](https://github.com/wp-graphql/wp-graphql-woocommerce/workflows/Testing Integration/badge.svg)](https://github.com/wp-graphql/wp-graphql-woocommerce/actions)[![Coverage Status](https://coveralls.io/repos/github/wp-graphql/wp-graphql-woocommerce/badge.svg?branch=develop)](https://coveralls.io/github/wp-graphql/wp-graphql-woocommerce?branch=develop) ## Quick Install 1. Install & activate [WooCommerce](https://woocommerce.com/) From 5b4ae09de8394c9e413226cdf71435901c76f59f Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 19 Feb 2020 19:48:01 -0500 Subject: [PATCH 30/36] testing-integration workflow updated. --- .github/workflows/testing-integration.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index 96a8aba78..fdb125d2d 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -56,6 +56,9 @@ jobs: - name: Push Codecoverage to Coveralls.io if: matrix.coverage == 1 + env: + COVERALLS_RUN_LOCALLY: 1 + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} run: | wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar chmod +x php-coveralls.phar From 55519378e6adffec22e15025b667abf1be5732a8 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Feb 2020 09:26:35 -0500 Subject: [PATCH 31/36] phpcs workflow test --- includes/model/class-coupon.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/includes/model/class-coupon.php b/includes/model/class-coupon.php index 85670887d..b99cd111f 100644 --- a/includes/model/class-coupon.php +++ b/includes/model/class-coupon.php @@ -1,12 +1,5 @@ Date: Thu, 20 Feb 2020 10:17:30 -0500 Subject: [PATCH 32/36] phpcs ruleset updated. --- .github/workflows/wordpress-coding-standard.yml | 2 +- .phpcs.ruleset.xml => .phpcs.xml | 5 +---- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++++------- vendor/composer/autoload_static.php | 8 ++++---- 5 files changed, 14 insertions(+), 17 deletions(-) rename .phpcs.ruleset.xml => .phpcs.xml (94%) diff --git a/.github/workflows/wordpress-coding-standard.yml b/.github/workflows/wordpress-coding-standard.yml index 8bbea856e..262914e31 100644 --- a/.github/workflows/wordpress-coding-standard.yml +++ b/.github/workflows/wordpress-coding-standard.yml @@ -49,4 +49,4 @@ jobs: wp-graphql-woocommerce.php \ access-functions.php \ class-inflect.php \ - includes/*.php --standard=WordPress \ No newline at end of file + includes/*.php \ No newline at end of file diff --git a/.phpcs.ruleset.xml b/.phpcs.xml similarity index 94% rename from .phpcs.ruleset.xml rename to .phpcs.xml index 456ba8869..2a4465a47 100644 --- a/.phpcs.ruleset.xml +++ b/.phpcs.xml @@ -26,10 +26,7 @@ - - - - + diff --git a/vendor/autoload.php b/vendor/autoload.php index 1530b2952..e5e60e815 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9::getLoader(); +return ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 81278391c..ec7503ef0 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9 +class ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918 { private static $loader; @@ -19,15 +19,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitea8d5368c9ddcbe5b88bdef7b5101ce9', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918', '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\ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitc1b6563d844021ea0246bd702005f918::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitc1b6563d844021ea0246bd702005f918::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequireea8d5368c9ddcbe5b88bdef7b5101ce9($fileIdentifier, $file); + composerRequirec1b6563d844021ea0246bd702005f918($fileIdentifier, $file); } return $loader; } } -function composerRequireea8d5368c9ddcbe5b88bdef7b5101ce9($fileIdentifier, $file) +function composerRequirec1b6563d844021ea0246bd702005f918($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index dbab3de01..148749a40 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9 +class ComposerStaticInitc1b6563d844021ea0246bd702005f918 { public static $files = array ( '914b07b8cf678ed0b81bfdb5d23b4f2b' => __DIR__ . '/../..' . '/includes/connection/common-post-type-args.php', @@ -171,9 +171,9 @@ class ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitea8d5368c9ddcbe5b88bdef7b5101ce9::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitc1b6563d844021ea0246bd702005f918::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc1b6563d844021ea0246bd702005f918::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc1b6563d844021ea0246bd702005f918::$classMap; }, null, ClassLoader::class); } From 04154d24a0eee44e7e00738c979317ad4f2f89aa Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Feb 2020 10:53:30 -0500 Subject: [PATCH 33/36] 100% WPCS compliance reached --- .phpcs.xml | 2 +- access-functions.php | 31 ++++++++++++++++++----- class-inflect.php | 2 +- includes/class-woocommerce-filters.php | 2 +- includes/class-wp-graphql-woocommerce.php | 6 ++--- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++----- vendor/composer/autoload_static.php | 8 +++--- wp-graphql-woocommerce.php | 18 ++++++++----- 9 files changed, 54 insertions(+), 31 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 2a4465a47..3a7152045 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -30,7 +30,7 @@ - + diff --git a/access-functions.php b/access-functions.php index f2dd11c48..0686a28c4 100644 --- a/access-functions.php +++ b/access-functions.php @@ -94,7 +94,7 @@ function wc_graphql_get_order_statuses() { */ function wc_graphql_price( $price, $args = array() ) { $args = apply_filters( - 'wc_price_args', + 'wc_price_args', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound wp_parse_args( $args, array( @@ -109,13 +109,32 @@ function wc_graphql_price( $price, $args = array() ) { $unformatted_price = $price; $negative = $price < 0; - $price = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * -1 : $price ) ); - $price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $args['decimals'], $args['decimal_separator'], $args['thousand_separator'] ), $price, $args['decimals'], $args['decimal_separator'], $args['thousand_separator'] ); + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + $price = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * -1 : $price ) ); + + + $price = apply_filters( + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + 'formatted_woocommerce_price', + number_format( + $price, + $args['decimals'], + $args['decimal_separator'], + $args['thousand_separator'] + ), + $price, + $args['decimals'], + $args['decimal_separator'], + $args['thousand_separator'] + ); + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( apply_filters( 'woocommerce_price_trim_zeros', false ) && $args['decimals'] > 0 ) { $price = wc_trim_zeros( $price ); } + // phpcs:ignore PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault.NotSet $symbol = html_entity_decode( get_woocommerce_currency_symbol( $args['currency'] ) ); $return = ( $negative ? '-' : '' ) . sprintf( $args['price_format'], $symbol, $price ); @@ -127,7 +146,7 @@ function wc_graphql_price( $price, $args = array() ) { * @param array $args Pass on the args. * @param float $unformatted_price Price as float to allow plugins custom formatting. Since 3.2.0. */ - return apply_filters( 'wc_graphql_price', $return, $price, $args, $unformatted_price, $symbol ); + return apply_filters( 'graphql_woocommerce_price', $return, $price, $args, $unformatted_price, $symbol ); } /** @@ -142,9 +161,9 @@ function wc_graphql_price_range( $from, $to ) { /* translators: 1: price from 2: price to */ _x( '%1$s %2$s %3$s', 'Price range: from-to', 'wp-graphql-woocommerce' ), is_numeric( $from ) ? wc_graphql_price( $from ) : $from, - apply_filters( 'graphql_format_price_range_separator', '-', $from, $to ), + apply_filters( 'graphql_woocommerce_format_price_range_separator', '-', $from, $to ), is_numeric( $to ) ? wc_graphql_price( $to ) : $to ); - return apply_filters( 'graphql_format_price_range', $price, $from, $to ); + return apply_filters( 'graphql_woocommerce_format_price_range', $price, $from, $to ); } diff --git a/class-inflect.php b/class-inflect.php index 2754a903b..d53891e9e 100644 --- a/class-inflect.php +++ b/class-inflect.php @@ -15,7 +15,7 @@ /** * Class Inflect */ - class Inflect { + class Inflect { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound /** * Stores plural suffixes. * diff --git a/includes/class-woocommerce-filters.php b/includes/class-woocommerce-filters.php index 3b720a963..fe427aaf8 100644 --- a/includes/class-woocommerce-filters.php +++ b/includes/class-woocommerce-filters.php @@ -24,7 +24,7 @@ class WooCommerce_Filters { * Initializes hooks for WooCommerce-related utilities. */ public static function setup() { - self::$session_header = apply_filters( 'graphql_woo_cart_session_http_header', 'woocommerce-session' ); + self::$session_header = apply_filters( 'graphql_woocommerce_cart_session_http_header', 'woocommerce-session' ); // Check if request is a GraphQL POST request. if ( ! defined( 'NO_QL_SESSION_HANDLER' ) ) { diff --git a/includes/class-wp-graphql-woocommerce.php b/includes/class-wp-graphql-woocommerce.php index 0665fd928..a75cb743d 100644 --- a/includes/class-wp-graphql-woocommerce.php +++ b/includes/class-wp-graphql-woocommerce.php @@ -53,7 +53,7 @@ public static function instance() { */ public static function get_post_types() { return apply_filters( - 'register_graphql_wc_post_types', + 'graphql_woocommerce_post_types', array( 'product', 'product_variation', @@ -71,7 +71,7 @@ public static function get_post_types() { */ public static function get_enabled_product_types() { return apply_filters( - 'graphql_enabled_wc_product_types', + 'graphql_woocommerce_product_types', array( 'simple' => 'SimpleProduct', 'variable' => 'VariableProduct', @@ -102,7 +102,7 @@ public static function get_product_attribute_taxonomies() { * @param array $attributes Product attributes being passed. */ return apply_filters( - 'register_graphql_wc_product_attributes_taxonomies', + 'graphql_woocommerce_product_attributes_taxonomies', $attributes ); } diff --git a/vendor/autoload.php b/vendor/autoload.php index e5e60e815..2d6f5224f 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918::getLoader(); +return ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index ec7503ef0..12047e10e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918 +class ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b { private static $loader; @@ -19,15 +19,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitc1b6563d844021ea0246bd702005f918', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b', '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\ComposerStaticInitc1b6563d844021ea0246bd702005f918::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitc1b6563d844021ea0246bd702005f918::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirec1b6563d844021ea0246bd702005f918($fileIdentifier, $file); + composerRequire69f434ca0d88e6427e8a87a92b78069b($fileIdentifier, $file); } return $loader; } } -function composerRequirec1b6563d844021ea0246bd702005f918($fileIdentifier, $file) +function composerRequire69f434ca0d88e6427e8a87a92b78069b($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 148749a40..e01e033da 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitc1b6563d844021ea0246bd702005f918 +class ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b { public static $files = array ( '914b07b8cf678ed0b81bfdb5d23b4f2b' => __DIR__ . '/../..' . '/includes/connection/common-post-type-args.php', @@ -171,9 +171,9 @@ class ComposerStaticInitc1b6563d844021ea0246bd702005f918 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitc1b6563d844021ea0246bd702005f918::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitc1b6563d844021ea0246bd702005f918::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitc1b6563d844021ea0246bd702005f918::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$classMap; }, null, ClassLoader::class); } diff --git a/wp-graphql-woocommerce.php b/wp-graphql-woocommerce.php index ba3a45b00..c67f8e381 100644 --- a/wp-graphql-woocommerce.php +++ b/wp-graphql-woocommerce.php @@ -30,15 +30,19 @@ */ if ( file_exists( __DIR__ . '/c3.php' ) ) { // Get tests output directory. - $test_dir = __DIR__ . '/tests/output'; - define( 'C3_CODECOVERAGE_ERROR_LOG_FILE', $test_dir . '/c3_error.log' ); + $woographql_test_dir = __DIR__ . '/tests/output'; + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound + define( 'C3_CODECOVERAGE_ERROR_LOG_FILE', $woographql_test_dir . '/c3_error.log' ); + + // Import c3 file. require_once __DIR__ . '/c3.php'; } /** * Setups WPGraphQL WooCommerce constants */ -function wp_graphql_woocommerce_constants() { +function woographql_constants() { // Plugin version. if ( ! defined( 'WPGRAPHQL_WOOCOMMERCE_VERSION' ) ) { define( 'WPGRAPHQL_WOOCOMMERCE_VERSION', '0.4.3' ); @@ -64,7 +68,7 @@ function wp_graphql_woocommerce_constants() { /** * Checks if WPGraphQL WooCommerce required plugins are installed and activated */ -function wp_graphql_woocommerce_dependencies_not_ready() { +function woographql_dependencies_not_ready() { $deps = array(); if ( ! class_exists( '\WPGraphQL' ) ) { $deps[] = 'WPGraphQL'; @@ -79,8 +83,8 @@ function wp_graphql_woocommerce_dependencies_not_ready() { /** * Initializes WPGraphQL WooCommerce */ -function wp_graphql_woocommerce_init() { - wp_graphql_woocommerce_constants(); +function woographql_init() { + woographql_constants(); $not_ready = wp_graphql_woocommerce_dependencies_not_ready(); if ( empty( $not_ready ) ) { @@ -111,4 +115,4 @@ function() use ( $dep ) { return false; } -add_action( 'graphql_init', 'wp_graphql_woocommerce_init' ); +add_action( 'graphql_init', 'woographql_init' ); From f8951d0b5e3d5202d261c923822b33398dba275b Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Feb 2020 10:59:26 -0500 Subject: [PATCH 34/36] function call fixed --- wp-graphql-woocommerce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-graphql-woocommerce.php b/wp-graphql-woocommerce.php index c67f8e381..00fd88143 100644 --- a/wp-graphql-woocommerce.php +++ b/wp-graphql-woocommerce.php @@ -86,7 +86,7 @@ function woographql_dependencies_not_ready() { function woographql_init() { woographql_constants(); - $not_ready = wp_graphql_woocommerce_dependencies_not_ready(); + $not_ready = woographql_dependencies_not_ready(); if ( empty( $not_ready ) ) { require_once WPGRAPHQL_WOOCOMMERCE_PLUGIN_DIR . 'includes/class-wp-graphql-woocommerce.php'; return WP_GraphQL_WooCommerce::instance(); From 68eeae01ed76dd3bf335468f993b354a1ef1bdff Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Feb 2020 12:11:24 -0500 Subject: [PATCH 35/36] True 100% WPCS compliance reached --- .phpcs.xml | 9 ++++--- includes/data/class-factory.php | 2 ++ .../class-customer-connection-resolver.php | 1 + .../class-product-connection-resolver.php | 1 + .../data/loader/class-wc-post-crud-loader.php | 2 +- .../data/mutation/class-cart-mutation.php | 8 +++--- .../data/mutation/class-checkout-mutation.php | 25 +++++++++++++------ .../data/mutation/class-customer-mutation.php | 4 +-- .../data/mutation/class-order-mutation.php | 14 +++++------ includes/model/class-crud-cpt.php | 1 + includes/model/class-customer.php | 1 + includes/model/class-order-item.php | 1 + includes/model/class-product.php | 4 +++ includes/model/class-shipping-method.php | 3 ++- includes/model/class-tax-rate.php | 1 + includes/mutation/class-cart-empty.php | 4 +-- .../class-cart-update-item-quantities.php | 12 ++++----- includes/mutation/class-checkout.php | 4 +-- includes/mutation/class-order-create.php | 8 +++--- .../mutation/class-order-delete-items.php | 4 +-- includes/mutation/class-order-delete.php | 4 +-- includes/mutation/class-order-update.php | 4 +-- .../enum/class-post-type-orderby-enum.php | 1 + includes/type/interface/class-product.php | 8 +++--- includes/type/object/class-cart-type.php | 4 +-- includes/type/object/class-coupon-type.php | 8 +++--- .../object/class-downloadable-item-type.php | 1 + includes/type/object/class-meta-data-type.php | 2 +- .../type/object/class-order-item-type.php | 2 +- includes/type/object/class-order-type.php | 4 +-- includes/type/object/class-product-types.php | 6 ++--- .../object/class-product-variation-type.php | 4 +-- includes/type/object/class-refund-type.php | 4 +-- .../object/class-shipping-method-type.php | 2 +- .../object/class-shipping-package-type.php | 3 +++ includes/utils/class-ql-session-handler.php | 12 ++++----- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++------ vendor/composer/autoload_static.php | 8 +++--- 39 files changed, 116 insertions(+), 86 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 3a7152045..77a3124a8 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -3,7 +3,10 @@ Generally-applicable sniffs for WordPress plugins. - . + wp-graphql-woocommerce.php + access-functions.php + class-inflect.php + includes/ /vendor/ /node_modules/ /tests/ @@ -19,7 +22,7 @@ - + @@ -30,7 +33,7 @@ - + diff --git a/includes/data/class-factory.php b/includes/data/class-factory.php index 636aac8db..a3dd41d0f 100644 --- a/includes/data/class-factory.php +++ b/includes/data/class-factory.php @@ -184,10 +184,12 @@ public static function resolve_shipping_method( $id ) { * @return \WC_Cart */ public static function resolve_cart() { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound do_action( 'woocommerce_before_calculate_totals', \WC()->cart ); new \WC_Cart_Totals( \WC()->cart ); + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound do_action( 'woocommerce_after_calculate_totals', \WC()->cart ); return \WC()->cart; diff --git a/includes/data/connection/class-customer-connection-resolver.php b/includes/data/connection/class-customer-connection-resolver.php index 3f838fd38..e55bea372 100644 --- a/includes/data/connection/class-customer-connection-resolver.php +++ b/includes/data/connection/class-customer-connection-resolver.php @@ -132,6 +132,7 @@ public function get_query_args() { } $query_args = apply_filters( + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound 'graphql_customer_connection_query_args', $query_args, $this->source, diff --git a/includes/data/connection/class-product-connection-resolver.php b/includes/data/connection/class-product-connection-resolver.php index 1b7b0fb99..bf85d9038 100644 --- a/includes/data/connection/class-product-connection-resolver.php +++ b/includes/data/connection/class-product-connection-resolver.php @@ -553,6 +553,7 @@ public function sanitize_input_fields( array $where_args ) { : PHP_INT_MAX; $meta_query[] = apply_filters( + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound 'woocommerce_get_min_max_price_meta_query', array( 'key' => '_price', diff --git a/includes/data/loader/class-wc-post-crud-loader.php b/includes/data/loader/class-wc-post-crud-loader.php index da1fc71f4..91d98b22a 100644 --- a/includes/data/loader/class-wc-post-crud-loader.php +++ b/includes/data/loader/class-wc-post-crud-loader.php @@ -53,7 +53,7 @@ private function resolve_model( $post_type, $id ) { case 'shop_order_refund': return new Refund( $id ); default: - $model = apply_filters( 'wc_post_crud_loader_model', null, $post_type ); + $model = apply_filters( 'graphql_woocommerce_crud_loader_model', null, $post_type ); if ( ! empty( $model ) ) { return new $model( $id ); } diff --git a/includes/data/mutation/class-cart-mutation.php b/includes/data/mutation/class-cart-mutation.php index 1a94b921a..5ec0ab6c6 100644 --- a/includes/data/mutation/class-cart-mutation.php +++ b/includes/data/mutation/class-cart-mutation.php @@ -51,7 +51,7 @@ public static function prepare_cart_item( $input, $context, $info ) { ? json_decode( $input['extraData'], true ) : array(); - return apply_filters( 'woocommerce_new_cart_item_data', $cart_item_args, $input, $context, $info ); + return apply_filters( 'graphql_woocommerce_new_cart_item_data', $cart_item_args, $input, $context, $info ); } /** @@ -82,7 +82,7 @@ public static function retrieve_cart_items( $input, $context, $info, $mutation = } } - return apply_filters( 'retrieve_cart_items', $items, $input, $context, $info, $mutation ); + return apply_filters( 'graphql_woocommerce_retrieve_cart_items', $items, $input, $context, $info, $mutation ); } /** @@ -102,7 +102,7 @@ public static function prepare_cart_fee( $input, $context, $info ) { ! empty( $input['taxClass'] ) ? $input['taxClass'] : '', ); - return apply_filters( 'woocommerce_new_cart_fee_data', $cart_item_args, $input, $context, $info ); + return apply_filters( 'graphql_woocommerce_new_cart_fee_data', $cart_item_args, $input, $context, $info ); } /** @@ -128,7 +128,7 @@ public static function item_is_valid( array $item ) { * @throws UserError If GRAPHQL_DEBUG is set to true and errors found. */ public static function check_session_token() { - $token_invalid = apply_filters( 'woo_session_token_errors', null ); + $token_invalid = apply_filters( 'graphql_woocommerce_session_token_errors', null ); if ( $token_invalid ) { throw new UserError( $token_invalid ); } diff --git a/includes/data/mutation/class-checkout-mutation.php b/includes/data/mutation/class-checkout-mutation.php index e8647160d..00600401b 100644 --- a/includes/data/mutation/class-checkout-mutation.php +++ b/includes/data/mutation/class-checkout-mutation.php @@ -36,6 +36,7 @@ class Checkout_Mutation { * @return boolean */ public static function is_registration_required() { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return apply_filters( 'woocommerce_checkout_registration_required', 'yes' !== get_option( 'woocommerce_enable_guest_checkout' ) ); } @@ -103,6 +104,7 @@ public static function prepare_checkout_args( $input, $context, $info ) { } } + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return apply_filters( 'woocommerce_checkout_posted_data', $data, $input, $context, $info ); } @@ -210,6 +212,7 @@ protected function update_session( $data ) { * @throws UserError When not able to create customer. */ protected static function process_customer( $data ) { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $customer_id = apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ); if ( ! is_user_logged_in() && ( self::is_registration_required() || ! empty( $data['createaccount'] ) ) ) { @@ -244,6 +247,7 @@ protected static function process_customer( $data ) { } // Add customer info from other fields. + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( $customer_id && apply_filters( 'woocommerce_checkout_update_customer_data', true, WC()->checkout() ) ) { $customer = new \WC_Customer( $customer_id ); @@ -271,16 +275,14 @@ protected static function process_customer( $data ) { } } - /** - * Action hook to adjust customer before save. - * - * @since 3.0.0 - */ + // Action hook to adjust customer before save. + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound do_action( 'woocommerce_checkout_update_customer', $customer, $data ); $customer->save(); } + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound do_action( 'woocommerce_checkout_update_user_meta', $customer_id, $data ); } @@ -345,6 +347,7 @@ protected static function validate_data( &$data ) { /* translators: %s: field name */ $postcode_validation_notice = sprintf( __( '%s is not a valid postcode / ZIP.', 'wp-graphql-woocommerce' ), $field_label ); } + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound throw new UserError( apply_filters( 'woocommerce_checkout_postcode_validation_notice', $postcode_validation_notice, $country, $data[ $key ] ) ); } } @@ -434,6 +437,7 @@ protected static function validate_checkout( &$data ) { } } + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound do_action( 'woocommerce_after_checkout_validation', $data ); } @@ -475,6 +479,7 @@ protected function process_order_without_payment( $order_id, $transaction_id = ' return array( 'result' => 'success', + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound 'redirect' => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $order->get_checkout_order_received_url(), $order ), ); } @@ -494,13 +499,13 @@ public static function process_checkout( $data, $input, $context, $info, &$resul wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true ); wc_set_time_limit( 0 ); - do_action( 'woocommerce_before_checkout_process' ); + do_action( 'woocommerce_before_checkout_process' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound if ( WC()->cart->is_empty() ) { throw new UserError( __( 'Sorry, your session has expired.', 'wp-graphql-woocommerce' ) ); } - do_action( 'woocommerce_checkout_process', $data, $context, $info ); + do_action( 'woocommerce_checkout_process', $data, $context, $info ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound // Update session for customer and totals. self::update_session( $data ); @@ -520,6 +525,7 @@ public static function process_checkout( $data, $input, $context, $info, &$resul throw new UserError( __( 'Unable to create order.', 'wp-graphql-woocommerce' ) ); } + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound do_action( 'woocommerce_checkout_order_processed', $order_id, $data, $order ); if ( WC()->cart->needs_payment() && ( empty( $input['isPaid'] ) || false === $input['isPaid'] ) ) { @@ -576,6 +582,7 @@ public static function process_checkout( $data, $input, $context, $info, &$resul */ public static function get_value( $input ) { // Allow 3rd parties to short circuit the logic and return their own default value. + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $value = apply_filters( 'woocommerce_checkout_get_value', null, $input ); if ( ! is_null( $value ) ) { return $value; @@ -607,6 +614,8 @@ public static function get_value( $input ) { if ( '' === $value ) { $value = null; } + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return apply_filters( 'default_checkout_' . $input, $value, $input ); } @@ -637,7 +646,7 @@ public static function add_order_meta( $order_id, $meta_data, $input, $context, * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_checkout_meta_save', $order, $meta_data, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_checkout_meta_save', $order, $meta_data, $input, $context, $info ); $order->save(); } diff --git a/includes/data/mutation/class-customer-mutation.php b/includes/data/mutation/class-customer-mutation.php index ca89759e0..d0e3bfd5a 100644 --- a/includes/data/mutation/class-customer-mutation.php +++ b/includes/data/mutation/class-customer-mutation.php @@ -44,7 +44,7 @@ public static function prepare_customer_props( $input, $mutation ) { * @var array $input Input data from the GraphQL mutation * @var string $mutation What customer mutation is being performed for context */ - $customer_args = apply_filters( 'woocommerce_new_customer_data', $customer_args, $input, $mutation ); + $customer_args = apply_filters( 'woocommerce_new_customer_data', $customer_args, $input, $mutation ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return $customer_args; } @@ -66,7 +66,7 @@ public static function address_input_mapping( $type = 'billing', $input ) { 'address2' => 'address_2', ); - $skip = apply_filters( 'customer_address_input_mapping_skipped', array( 'overwrite' ) ); + $skip = apply_filters( 'graphql_woocommerce_customer_address_input_mapping_skipped', array( 'overwrite' ) ); $type = 'empty_' . $type; $address = ! empty( $input['overwrite'] ) && true === $input['overwrite'] diff --git a/includes/data/mutation/class-order-mutation.php b/includes/data/mutation/class-order-mutation.php index 3fb0257ff..a9c4d00ac 100644 --- a/includes/data/mutation/class-order-mutation.php +++ b/includes/data/mutation/class-order-mutation.php @@ -29,7 +29,7 @@ public static function authorized( $mutation = 'create', $order_id = null, $inpu $post_type_object = get_post_type_object( 'shop_order' ); return apply_filters( - "authorized_to_{$mutation}_orders", + "graphql_woocommerce_authorized_to_{$mutation}_orders", current_user_can( 'delete' === $mutation ? $post_type_object->cap->delete_posts @@ -78,7 +78,7 @@ public static function create_order( $input, $context, $info ) { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_order_create', $input, $context, $info ); + do_action( 'graphql_woocommerce_before_order_create', $input, $context, $info ); $order = \wc_create_order( $args ); if ( is_wp_error( $order ) ) { @@ -93,7 +93,7 @@ public static function create_order( $input, $context, $info ) { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_after_order_create', $order, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_order_create', $order, $input, $context, $info ); return $order->get_id(); } @@ -126,7 +126,7 @@ public static function add_items( $input, $order_id, $context, $info ) { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( "woocommerce_graphql_before_{$type}s_added_to_order", $items, $order_id, $context, $info ); + do_action( "graphql_woocommerce_before_{$type}s_added_to_order", $items, $order_id, $context, $info ); foreach ( $items as $item_data ) { // Create Order item. @@ -152,7 +152,7 @@ public static function add_items( $input, $order_id, $context, $info ) { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( "woocommerce_graphql_after_{$type}s_added_to_order", $items, $order_id, $context, $info ); + do_action( "graphql_woocommerce_after_{$type}s_added_to_order", $items, $order_id, $context, $info ); } } } @@ -331,7 +331,7 @@ public static function add_order_meta( $order_id, $input, $context, $info ) { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_order_meta_save', $order, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_order_meta_save', $order, $input, $context, $info ); $order->save(); } @@ -372,7 +372,7 @@ public static function apply_coupons( $order_id, $coupons ) { foreach ( $coupons as $code ) { $results = $order->apply_coupon( wc_clean( $code ) ); if ( is_wp_error( $results ) ) { - do_action( 'woocommerce_graphql_' . $results->get_error_code(), $results, $code, $coupons, $order ); + do_action( 'graphql_woocommerce_' . $results->get_error_code(), $results, $code, $coupons, $order ); } } diff --git a/includes/model/class-crud-cpt.php b/includes/model/class-crud-cpt.php index b3e8d8b22..544d9008a 100644 --- a/includes/model/class-crud-cpt.php +++ b/includes/model/class-crud-cpt.php @@ -48,6 +48,7 @@ public function __construct( $allowed_restricted_fields, $post_type, $post_id ) setup_postdata( $post ); $restricted_cap = apply_filters( + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound $this->post_type_object->name . '_restricted_cap', $this->get_restricted_cap() ); diff --git a/includes/model/class-customer.php b/includes/model/class-customer.php index 79e32eb9a..a31d6488a 100644 --- a/includes/model/class-customer.php +++ b/includes/model/class-customer.php @@ -35,6 +35,7 @@ public function __construct( $id = 'session' ) { 'displayName', ); + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $restricted_cap = apply_filters( 'customer_restricted_cap', 'session' === $id ? '' : 'list_users' ); parent::__construct( $restricted_cap, $allowed_restricted_fields, $id ); diff --git a/includes/model/class-order-item.php b/includes/model/class-order-item.php index a21735660..45017ade5 100644 --- a/includes/model/class-order-item.php +++ b/includes/model/class-order-item.php @@ -50,6 +50,7 @@ public function __construct( $item ) { 'orderItemId', ); + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $restricted_cap = apply_filters( 'order_item_restricted_cap', '' ); parent::__construct( $restricted_cap, $allowed_restricted_fields, $author_id ); diff --git a/includes/model/class-product.php b/includes/model/class-product.php index b1c0c4fef..a0a146a3e 100644 --- a/includes/model/class-product.php +++ b/includes/model/class-product.php @@ -184,17 +184,21 @@ protected function init() { }, 'description' => function() { return ! empty( $this->data->get_description() ) + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound ? apply_filters( 'the_content', $this->data->get_description() ) : null; }, 'shortDescription' => function() { $short_description = ! empty( $this->data->get_short_description() ) ? apply_filters( + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound 'get_the_excerpt', $this->data->get_short_description(), get_post( $this->data->get_id() ) ) : null; + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return apply_filters( 'the_excerpt', $short_description ); }, 'sku' => function() { diff --git a/includes/model/class-shipping-method.php b/includes/model/class-shipping-method.php index 0ba216db8..ca2769639 100644 --- a/includes/model/class-shipping-method.php +++ b/includes/model/class-shipping-method.php @@ -32,7 +32,8 @@ public function __construct( $method ) { 'id', 'rateId', ); - + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $restricted_cap = apply_filters( 'shipping_method_restricted_cap', '' ); parent::__construct( $restricted_cap, $allowed_restricted_fields, null ); diff --git a/includes/model/class-tax-rate.php b/includes/model/class-tax-rate.php index bb2869f66..8f5e43205 100644 --- a/includes/model/class-tax-rate.php +++ b/includes/model/class-tax-rate.php @@ -33,6 +33,7 @@ public function __construct( $rate ) { 'rateId', ); + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $restricted_cap = apply_filters( 'tax_rate_restricted_cap', '' ); parent::__construct( $restricted_cap, $allowed_restricted_fields, null ); diff --git a/includes/mutation/class-cart-empty.php b/includes/mutation/class-cart-empty.php index f6788babb..9bb78a841 100644 --- a/includes/mutation/class-cart-empty.php +++ b/includes/mutation/class-cart-empty.php @@ -64,7 +64,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Context passed. * @param ResolveInfo $info Resolver info passed. */ - do_action( 'woocommerce_graphql_before_empty_cart', $cloned_cart, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_empty_cart', $cloned_cart, $input, $context, $info ); // Empty cart. \WC()->cart->empty_cart(); @@ -77,7 +77,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Context passed. * @param ResolveInfo $info Resolver info passed. */ - do_action( 'woocommerce_graphql_after_empty_cart', $cloned_cart, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_empty_cart', $cloned_cart, $input, $context, $info ); return array( 'cart' => $cloned_cart ); }; diff --git a/includes/mutation/class-cart-update-item-quantities.php b/includes/mutation/class-cart-update-item-quantities.php index 8c2548584..f306c0a81 100644 --- a/includes/mutation/class-cart-update-item-quantities.php +++ b/includes/mutation/class-cart-update-item-quantities.php @@ -107,7 +107,7 @@ public static function mutate_and_get_payload() { throw new UserError( __( 'Provided "items" invalid', 'wp-graphql-woocommerce' ) ); } - do_action( 'woocommerce_graphql_before_set_item_quantities', $input['items'], $input, $context, $info ); + do_action( 'graphql_woocommerce_before_set_item_quantities', $input['items'], $input, $context, $info ); // Update quantities. If quantity set to 0, the items in removed. $removed = array(); @@ -120,14 +120,14 @@ public static function mutate_and_get_payload() { if ( 0 === $quantity ) { $removed_item = \WC()->cart->get_cart_item( $key ); $removed_items[] = $removed_item; - do_action( 'woocommerce_graphql_before_remove_item', $removed_item, 'update_quantity', $input, $context, $info ); + do_action( 'graphql_woocommerce_before_remove_item', $removed_item, 'update_quantity', $input, $context, $info ); $removed[ $key ] = \WC()->cart->remove_cart_item( $key ); - do_action( 'woocommerce_graphql_after_remove_item', $removed_item, 'update_quantity', $input, $context, $info ); + do_action( 'graphql_woocommerce_after_remove_item', $removed_item, 'update_quantity', $input, $context, $info ); continue; } - do_action( 'woocommerce_graphql_before_set_item_quantity', \WC()->cart->get_cart_item( $key ), $input, $context, $info ); + do_action( 'graphql_woocommerce_before_set_item_quantity', \WC()->cart->get_cart_item( $key ), $input, $context, $info ); $updated[ $key ] = \WC()->cart->set_quantity( $key, $quantity, true ); - do_action( 'woocommerce_graphql_after_set_item_quantity', \WC()->cart->get_cart_item( $key ), $input, $context, $info ); + do_action( 'graphql_woocommerce_after_set_item_quantity', \WC()->cart->get_cart_item( $key ), $input, $context, $info ); } } @@ -155,7 +155,7 @@ function( $value ) { } do_action( - 'woocommerce_graphql_before_set_item_quantities', + 'graphql_woocommerce_before_set_item_quantities', array_keys( $updated ), array_keys( $removed ), $input, diff --git a/includes/mutation/class-checkout.php b/includes/mutation/class-checkout.php index 7fc2e92c6..e7a037736 100644 --- a/includes/mutation/class-checkout.php +++ b/includes/mutation/class-checkout.php @@ -138,7 +138,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_checkout', $args, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_checkout', $args, $input, $context, $info ); $order_id = Checkout_Mutation::process_checkout( $args, $input, $context, $info, $results ); @@ -159,7 +159,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_after_checkout', $order_id, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_checkout', $order_id, $input, $context, $info ); return array_merge( array( 'id' => $order_id ), $results ); } catch ( Exception $e ) { diff --git a/includes/mutation/class-order-create.php b/includes/mutation/class-order-create.php index 6858eeb81..09027dfd8 100644 --- a/includes/mutation/class-order-create.php +++ b/includes/mutation/class-order-create.php @@ -66,15 +66,15 @@ public static function get_input_fields() { ), 'status' => array( 'type' => 'OrderStatusEnum', - 'description' => __( 'Order status' ), + 'description' => __( 'Order status', 'wp-graphql-woocommerce' ), ), 'paymentMethod' => array( 'type' => 'String', - 'description' => __( 'Payment method ID.', 'woocommerce' ), + 'description' => __( 'Payment method ID.', 'wp-graphql-woocommerce' ), ), 'paymentMethodTitle' => array( 'type' => 'String', - 'description' => __( 'Payment method title.', 'woocommerce' ), + 'description' => __( 'Payment method title.', 'wp-graphql-woocommerce' ), ), 'transactionId' => array( 'type' => 'String', @@ -189,7 +189,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_after_order_create', $order, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_order_create', $order, $input, $context, $info ); return array( 'id' => $order->get_id() ); } catch ( Exception $e ) { diff --git a/includes/mutation/class-order-delete-items.php b/includes/mutation/class-order-delete-items.php index ad3c861ac..b081496dc 100644 --- a/includes/mutation/class-order-delete-items.php +++ b/includes/mutation/class-order-delete-items.php @@ -134,7 +134,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_order_items_delete', $ids, $working_order, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_order_items_delete', $ids, $working_order, $input, $context, $info ); // Delete order. $errors = ''; @@ -151,7 +151,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_after_order_delete', $ids, $working_order, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_order_delete', $ids, $working_order, $input, $context, $info ); return array( 'order' => $order ); }; diff --git a/includes/mutation/class-order-delete.php b/includes/mutation/class-order-delete.php index 4f00206d2..e22ec897b 100644 --- a/includes/mutation/class-order-delete.php +++ b/includes/mutation/class-order-delete.php @@ -129,7 +129,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_order_delete', $order, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_order_delete', $order, $input, $context, $info ); // Delete order. $success = Order_Mutation::purge( WC_Order_Factory::get_order( $order->ID ), $force_delete ); @@ -152,7 +152,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_after_order_delete', $order, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_order_delete', $order, $input, $context, $info ); return array( 'order' => $order ); }; diff --git a/includes/mutation/class-order-update.php b/includes/mutation/class-order-update.php index 152c4c9c3..d630ea423 100644 --- a/includes/mutation/class-order-update.php +++ b/includes/mutation/class-order-update.php @@ -112,7 +112,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_before_order_update', $order_id, $input, $context, $info ); + do_action( 'graphql_woocommerce_before_order_update', $order_id, $input, $context, $info ); Order_Mutation::add_order_meta( $order_id, $input, $context, $info ); Order_Mutation::add_items( $input, $order_id, $context, $info ); @@ -158,7 +158,7 @@ public static function mutate_and_get_payload() { * @param AppContext $context Request AppContext instance. * @param ResolveInfo $info Request ResolveInfo instance. */ - do_action( 'woocommerce_graphql_after_order_update', $order, $input, $context, $info ); + do_action( 'graphql_woocommerce_after_order_update', $order, $input, $context, $info ); return array( 'id' => $order->get_id() ); }; diff --git a/includes/type/enum/class-post-type-orderby-enum.php b/includes/type/enum/class-post-type-orderby-enum.php index a0537128a..0100bec07 100644 --- a/includes/type/enum/class-post-type-orderby-enum.php +++ b/includes/type/enum/class-post-type-orderby-enum.php @@ -80,6 +80,7 @@ public static function register() { __( 'Fields to order the %s connection by', 'wp-graphql-woocommerce' ), $name ), + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound 'values' => apply_filters( "{$name}_orderby_enum_values", static::values() ), ) ); diff --git a/includes/type/interface/class-product.php b/includes/type/interface/class-product.php index 32f55051e..e24a56fcb 100644 --- a/includes/type/interface/class-product.php +++ b/includes/type/interface/class-product.php @@ -93,10 +93,10 @@ public static function register_interface( &$type_registry ) { if ( empty( $product_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product ID was found corresponding to the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No product ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } elseif ( get_post( $product_id )->post_type !== 'product' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product exists with the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No product exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } return Factory::resolve_crud_object( $product_id, $context ); @@ -162,10 +162,10 @@ public static function register_interface( &$type_registry ) { if ( empty( $product_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product ID was found corresponding to the %1$s: %2$s' ), $id_type, $product_id ) ); + throw new UserError( sprintf( __( 'No product ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $product_id ) ); } elseif ( get_post( $product_id )->post_type !== 'product' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product exists with the %1$s: %2$s' ), $id_type, $product_id ) ); + throw new UserError( sprintf( __( 'No product exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $product_id ) ); } return Factory::resolve_crud_object( $product_id, $context ); diff --git a/includes/type/object/class-cart-type.php b/includes/type/object/class-cart-type.php index e35ad25a3..46f02ff3a 100644 --- a/includes/type/object/class-cart-type.php +++ b/includes/type/object/class-cart-type.php @@ -35,7 +35,7 @@ public static function register() { 'type' => 'Cart', 'description' => __( 'The cart object', 'wp-graphql-woocommerce' ), 'resolve' => function() { - $token_invalid = apply_filters( 'woo_session_token_errors', null ); + $token_invalid = apply_filters( 'graphql_woocommerce_session_token_errors', null ); if ( $token_invalid ) { throw new UserError( $token_invalid ); } @@ -216,7 +216,7 @@ public static function register_cart() { 'resolve' => function( $source ) { $source->calculate_totals(); $price = isset( $source->get_totals()['total'] ) - ? apply_filters( 'woocommerce_cart_get_total', $source->get_totals()['total'] ) + ? apply_filters( 'graphql_woocommerce_cart_get_total', $source->get_totals()['total'] ) : null; return \wc_graphql_price( $price ); }, diff --git a/includes/type/object/class-coupon-type.php b/includes/type/object/class-coupon-type.php index 6410e1f3a..a91f55e68 100644 --- a/includes/type/object/class-coupon-type.php +++ b/includes/type/object/class-coupon-type.php @@ -147,10 +147,10 @@ public static function register() { if ( empty( $coupon_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No coupon ID was found corresponding to the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No coupon ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } elseif ( get_post( $coupon_id )->post_type !== 'shop_coupon' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No coupon exists with the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No coupon exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } return Factory::resolve_crud_object( $coupon_id, $context ); @@ -211,10 +211,10 @@ public static function register() { if ( empty( $coupon_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No coupon ID was found corresponding to the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No coupon ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } elseif ( get_post( $coupon_id )->post_type !== 'shop_coupon' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No coupon exists with the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No coupon exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } return Factory::resolve_crud_object( $coupon_id, $context ); diff --git a/includes/type/object/class-downloadable-item-type.php b/includes/type/object/class-downloadable-item-type.php index 676580aef..3332703e3 100644 --- a/includes/type/object/class-downloadable-item-type.php +++ b/includes/type/object/class-downloadable-item-type.php @@ -97,6 +97,7 @@ public static function register() { ); $download->set_file( apply_filters( + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound 'woocommerce_file_download_path', $download_data['file'], \WC()->product_factory->get_product( $product_id ), diff --git a/includes/type/object/class-meta-data-type.php b/includes/type/object/class-meta-data-type.php index d2502de28..9ab8d2a4b 100644 --- a/includes/type/object/class-meta-data-type.php +++ b/includes/type/object/class-meta-data-type.php @@ -99,7 +99,7 @@ public static function register() { ); } // Create meta ID prefix. - $id_prefix = apply_filters( 'cart_meta_id_prefix', 'cart_' ); + $id_prefix = apply_filters( 'graphql_woocommerce_cart_meta_id_prefix', 'cart_' ); // Format meta data for resolution. $data = array(); diff --git a/includes/type/object/class-order-item-type.php b/includes/type/object/class-order-item-type.php index 8a3871f09..601581668 100644 --- a/includes/type/object/class-order-item-type.php +++ b/includes/type/object/class-order-item-type.php @@ -242,7 +242,7 @@ public static function register() { register_graphql_object_type( 'OrderItemTax', array( - 'description' => __( 'Order item tax statement', 'wp-graphql-woocommercer' ), + 'description' => __( 'Order item tax statement', 'wp-graphql-woocommerce' ), 'fields' => array( 'taxLineId' => array( 'type' => array( 'non_null' => 'Int' ), diff --git a/includes/type/object/class-order-type.php b/includes/type/object/class-order-type.php index 265119d89..d77d2c999 100644 --- a/includes/type/object/class-order-type.php +++ b/includes/type/object/class-order-type.php @@ -385,10 +385,10 @@ public static function register() { if ( empty( $order_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No order ID was found corresponding to the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No order ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } elseif ( get_post( $order_id )->post_type !== 'shop_order' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No order exists with the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No order exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } // Check if user authorized to view order. diff --git a/includes/type/object/class-product-types.php b/includes/type/object/class-product-types.php index 354d6bbc4..500814ca5 100644 --- a/includes/type/object/class-product-types.php +++ b/includes/type/object/class-product-types.php @@ -418,13 +418,13 @@ private static function register_product_query( $type ) { if ( empty( $product_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product ID was found corresponding to the %1$s: %2$s' ), $id_type, $product_id ) ); + throw new UserError( sprintf( __( 'No product ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $product_id ) ); } elseif ( \WC()->product_factory->get_product_type( $product_id ) !== $type ) { /* translators: Invalid product type message %1$s: Product ID, %2$s: Product type */ - throw new UserError( sprintf( __( 'This product of ID %1$s is not a %2$s product' ), $product_id, $type ) ); + throw new UserError( sprintf( __( 'This product of ID %1$s is not a %2$s product', 'wp-graphql-woocommerce' ), $product_id, $type ) ); } elseif ( get_post( $product_id )->post_type !== 'product' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product exists with the %1$s: %2$s' ), $id_type, $product_id ) ); + throw new UserError( sprintf( __( 'No product exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $product_id ) ); } $product = Factory::resolve_crud_object( $product_id, $context ); diff --git a/includes/type/object/class-product-variation-type.php b/includes/type/object/class-product-variation-type.php index 45b453602..fe3373a0a 100644 --- a/includes/type/object/class-product-variation-type.php +++ b/includes/type/object/class-product-variation-type.php @@ -298,10 +298,10 @@ public static function register() { if ( empty( $variation_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product variation ID was found corresponding to the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No product variation ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } elseif ( get_post( $variation_id )->post_type !== 'product_variation' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No product variation exists with the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No product variation exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } return Factory::resolve_crud_object( $variation_id, $context ); diff --git a/includes/type/object/class-refund-type.php b/includes/type/object/class-refund-type.php index e53ab0c66..246ee3054 100644 --- a/includes/type/object/class-refund-type.php +++ b/includes/type/object/class-refund-type.php @@ -99,10 +99,10 @@ public static function register() { if ( empty( $refund_id ) ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No refund ID was found corresponding to the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No refund ID was found corresponding to the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } elseif ( get_post( $refund_id )->post_type !== 'shop_order_refund' ) { /* translators: %1$s: ID type, %2$s: ID value */ - throw new UserError( sprintf( __( 'No refund exists with the %1$s: %2$s' ), $id_type, $id ) ); + throw new UserError( sprintf( __( 'No refund exists with the %1$s: %2$s', 'wp-graphql-woocommerce' ), $id_type, $id ) ); } // Check if user authorized to view order. diff --git a/includes/type/object/class-shipping-method-type.php b/includes/type/object/class-shipping-method-type.php index 2780279dc..fe810fff8 100644 --- a/includes/type/object/class-shipping-method-type.php +++ b/includes/type/object/class-shipping-method-type.php @@ -26,7 +26,7 @@ public static function register() { register_graphql_object_type( 'ShippingMethod', array( - 'description' => __( 'A shipping method object', 'wp-graphql-woocommercer' ), + 'description' => __( 'A shipping method object', 'wp-graphql-woocommerce' ), 'interfaces' => array( 'Node' ), 'fields' => array( 'id' => array( diff --git a/includes/type/object/class-shipping-package-type.php b/includes/type/object/class-shipping-package-type.php index f12f24403..6cb195e62 100644 --- a/includes/type/object/class-shipping-package-type.php +++ b/includes/type/object/class-shipping-package-type.php @@ -32,6 +32,8 @@ public static function register() { foreach ( $source['contents'] as $item_id => $values ) { $product_names[ $item_id ] = $values['data']->get_name() . ' ×' . $values['quantity']; } + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $product_names = apply_filters( 'woocommerce_shipping_package_details_array', $product_names, $source ); return implode( ', ', $product_names ); @@ -48,6 +50,7 @@ public static function register() { 'type' => 'Boolean', 'description' => __( 'This shipping package supports the shipping calculator.', 'wp-graphql-woocommerce' ), 'resolve' => function( $source ) { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound return apply_filters( 'woocommerce_shipping_show_shipping_calculator', true, $source['index'], $source ); }, ), diff --git a/includes/utils/class-ql-session-handler.php b/includes/utils/class-ql-session-handler.php index a641fabb9..7f6749d3b 100644 --- a/includes/utils/class-ql-session-handler.php +++ b/includes/utils/class-ql-session-handler.php @@ -49,7 +49,7 @@ class QL_Session_Handler extends WC_Session_Handler { * Constructor for the session class. */ public function __construct() { - $this->_token = apply_filters( 'graphql_woo_cart_session_http_header', 'woocommerce-session' ); + $this->_token = apply_filters( 'graphql_woocommerce_cart_session_http_header', 'woocommerce-session' ); $this->_table = $GLOBALS['wpdb']->prefix . 'woocommerce_sessions'; } @@ -238,7 +238,7 @@ public function init_session_token() { } else { if ( is_wp_error( $token ) ) { add_filter( - 'woo_session_token_errors', + 'graphql_woocommerce_session_token_errors', function( $errors ) use ( $token ) { $errors = $token->get_error_message(); return $errors; @@ -317,7 +317,7 @@ public function get_session_header() { * * @param string $session_header The header used to identify a user's cart session token. */ - return apply_filters( 'graphql_woo_cart_session_header', $session_header ); + return apply_filters( 'graphql_woocommerce_cart_session_header', $session_header ); } /** @@ -362,7 +362,7 @@ public function set_customer_session_token( $set ) { * @param array $session_data Session data associated with token. */ $token = apply_filters( - 'graphql_woo_cart_session_before_token_sign', + 'graphql_woocommerce_cart_session_before_token_sign', $token, $this->_customer_id, $this->_data @@ -382,7 +382,7 @@ public function set_customer_session_token( $set ) { * @param array $session_data Session data associated with token. */ $token = apply_filters( - 'graphql_woo_cart_session_signed_token', + 'graphql_woocommerce_cart_session_signed_token', $token, $this->_customer_id, $this->_data @@ -425,7 +425,7 @@ public function set_session_expiration() { $this->_session_issued = time(); // 48 Hours. $this->_session_expiration = apply_filters( - 'graphql_woo_cart_session_expire', + 'graphql_woocommerce_cart_session_expire', time() + ( 3600 * 48 ) ); // 47 Hours. diff --git a/vendor/autoload.php b/vendor/autoload.php index 2d6f5224f..17e31e50e 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b::getLoader(); +return ComposerAutoloaderInit605a02cd7bfd584c6ac9e4f2b4d51817::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 12047e10e..0f377840e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b +class ComposerAutoloaderInit605a02cd7bfd584c6ac9e4f2b4d51817 { private static $loader; @@ -19,15 +19,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit605a02cd7bfd584c6ac9e4f2b4d51817', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit69f434ca0d88e6427e8a87a92b78069b', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit605a02cd7bfd584c6ac9e4f2b4d51817', '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\ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit605a02cd7bfd584c6ac9e4f2b4d51817::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit605a02cd7bfd584c6ac9e4f2b4d51817::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire69f434ca0d88e6427e8a87a92b78069b($fileIdentifier, $file); + composerRequire605a02cd7bfd584c6ac9e4f2b4d51817($fileIdentifier, $file); } return $loader; } } -function composerRequire69f434ca0d88e6427e8a87a92b78069b($fileIdentifier, $file) +function composerRequire605a02cd7bfd584c6ac9e4f2b4d51817($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index e01e033da..d0583a046 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b +class ComposerStaticInit605a02cd7bfd584c6ac9e4f2b4d51817 { public static $files = array ( '914b07b8cf678ed0b81bfdb5d23b4f2b' => __DIR__ . '/../..' . '/includes/connection/common-post-type-args.php', @@ -171,9 +171,9 @@ class ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit69f434ca0d88e6427e8a87a92b78069b::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit605a02cd7bfd584c6ac9e4f2b4d51817::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit605a02cd7bfd584c6ac9e4f2b4d51817::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit605a02cd7bfd584c6ac9e4f2b4d51817::$classMap; }, null, ClassLoader::class); } From 6ba59abd14953d0787500e531abdd71d04b92932 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Feb 2020 12:13:11 -0500 Subject: [PATCH 36/36] wordpress-coding-standards workflow updated. --- ...-coding-standard.yml => wordpress-coding-standards.yml} | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) rename .github/workflows/{wordpress-coding-standard.yml => wordpress-coding-standards.yml} (87%) diff --git a/.github/workflows/wordpress-coding-standard.yml b/.github/workflows/wordpress-coding-standards.yml similarity index 87% rename from .github/workflows/wordpress-coding-standard.yml rename to .github/workflows/wordpress-coding-standards.yml index 262914e31..4342619a8 100644 --- a/.github/workflows/wordpress-coding-standard.yml +++ b/.github/workflows/wordpress-coding-standards.yml @@ -44,9 +44,4 @@ jobs: restore-keys: ${{ runner.os }}-composer - name: Run PHP CodeSniffer - run: | - vendor/bin/phpcs \ - wp-graphql-woocommerce.php \ - access-functions.php \ - class-inflect.php \ - includes/*.php \ No newline at end of file + run: vendor/bin/phpcs \ No newline at end of file