From 1d07c241cf62c7818fccefdb38fa323fb139faf7 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Fri, 16 Feb 2024 14:21:03 -0800 Subject: [PATCH 01/13] Add WP_Mock for tests --- composer.json | 9 +- composer.lock | 2253 +++++++++++++++++++++++++++++++++-- patchwork.json | 5 + phpunit.xml | 17 + tests/phpunit/bootstrap.php | 24 + 5 files changed, 2227 insertions(+), 81 deletions(-) create mode 100644 patchwork.json create mode 100644 phpunit.xml create mode 100644 tests/phpunit/bootstrap.php diff --git a/composer.json b/composer.json index 5e5a1a2..0d18f4e 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,11 @@ "bootstrap.php" ] }, + "autoload-dev": { + "psr-4": { + "NewfoldLabs\\WP\\Module\\Data\\": "tests/phpunit/includes/" + } + }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true @@ -44,11 +49,13 @@ "lint": "Check files against coding standards." }, "require": { - "wp-forge/wp-upgrade-handler": "^1.0", + "newfold-labs/wp-module-loader": "^1.0", "wp-forge/wp-query-builder": "^1.0", + "wp-forge/wp-upgrade-handler": "^1.0", "wpscholar/url": "^1.2" }, "require-dev": { + "10up/wp_mock": "^0.4.2", "newfold-labs/wp-php-standards": "^1.2" } } diff --git a/composer.lock b/composer.lock index 39d5e33..0f37edf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,203 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7da23aba55c14b76e6a439788249666d", + "content-hash": "f248eda5612deab791ab1f8c891ea3f5", "packages": [ + { + "name": "newfold-labs/container", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/container.git", + "reference": "19bb75bb4a64a282f7d142fff9f3418177022851" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/container/zipball/19bb75bb4a64a282f7d142fff9f3418177022851", + "reference": "19bb75bb4a64a282f7d142fff9f3418177022851", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\Container\\": "includes" + } + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "A lightweight, PHP 7.0+ compatible, PSR-11 dependency injection container.", + "support": { + "source": "https://github.com/newfold-labs/container/tree/1.2.2" + }, + "time": "2022-08-26T17:23:54+00:00" + }, + { + "name": "newfold-labs/wp-module-loader", + "version": "1.0.10", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-loader.git", + "reference": "8ab6725a6b3bc9ed10b89127f09bcb3e81f795c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-loader/zipball/8ab6725a6b3bc9ed10b89127f09bcb3e81f795c6", + "reference": "8ab6725a6b3bc9ed10b89127f09bcb3e81f795c6", + "shasum": "" + }, + "require": { + "newfold-labs/container": "^1.2", + "wp-forge/collection": "^1.0", + "wp-forge/fluent": "^1.0", + "wp-forge/wp-options": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\WP\\ModuleLoader\\": "includes" + }, + "files": [ + "bootstrap.php", + "includes/functions.php" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "A module that handles registration and management of Newfold modules used within our WordPress plugins.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-loader/tree/1.0.10", + "issues": "https://github.com/newfold-labs/wp-module-loader/issues" + }, + "time": "2022-10-03T20:07:41+00:00" + }, + { + "name": "wp-forge/collection", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/wp-forge/collection.git", + "reference": "e304ddc0130d466dcc55e3a8dee79f0d745ca47a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-forge/collection/zipball/e304ddc0130d466dcc55e3a8dee79f0d745ca47a", + "reference": "e304ddc0130d466dcc55e3a8dee79f0d745ca47a", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "WP_Forge\\Collection\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "A PHP utility class for manipulating collections.", + "support": { + "issues": "https://github.com/wp-forge/collection/issues", + "source": "https://github.com/wp-forge/collection/tree/1.0.2" + }, + "time": "2022-08-26T17:42:31+00:00" + }, + { + "name": "wp-forge/fluent", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/wp-forge/fluent.git", + "reference": "b7d6e54f86bd2bbc229faeefd2772f1f1354ad8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-forge/fluent/zipball/b7d6e54f86bd2bbc229faeefd2772f1f1354ad8c", + "reference": "b7d6e54f86bd2bbc229faeefd2772f1f1354ad8c", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "WP_Forge\\Fluent\\": "includes" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "An instance of the Laravel Fluent class for use with WordPress.", + "support": { + "issues": "https://github.com/wp-forge/fluent/issues", + "source": "https://github.com/wp-forge/fluent/tree/1.0.1" + }, + "time": "2022-08-26T17:38:37+00:00" + }, + { + "name": "wp-forge/wp-options", + "version": "1.1", + "source": { + "type": "git", + "url": "https://github.com/wp-forge/wp-options.git", + "reference": "df8899255dee19365599caa8801c75803e94e413" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-forge/wp-options/zipball/df8899255dee19365599caa8801c75803e94e413", + "reference": "df8899255dee19365599caa8801c75803e94e413", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "WP_Forge\\Options\\": "includes" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "A WordPress helper class for managing plugin options.", + "support": { + "issues": "https://github.com/wp-forge/wp-options/issues", + "source": "https://github.com/wp-forge/wp-options/tree/1.1" + }, + "time": "2022-03-04T16:23:42+00:00" + }, { "name": "wp-forge/wp-query-builder", "version": "1.0.3", @@ -128,6 +323,99 @@ } ], "packages-dev": [ + { + "name": "10up/wp_mock", + "version": "0.4.2", + "source": { + "type": "git", + "url": "https://github.com/10up/wp_mock.git", + "reference": "9019226eb50df275aa86bb15bfc98a619601ee49" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/10up/wp_mock/zipball/9019226eb50df275aa86bb15bfc98a619601ee49", + "reference": "9019226eb50df275aa86bb15bfc98a619601ee49", + "shasum": "" + }, + "require": { + "antecedent/patchwork": "^2.1", + "mockery/mockery": "^1.0", + "php": ">=7.1", + "phpunit/phpunit": ">=7.0" + }, + "require-dev": { + "behat/behat": "^3.0", + "php-coveralls/php-coveralls": "^2.1", + "sebastian/comparator": ">=1.2.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "WP_Mock\\": "./php/WP_Mock" + }, + "classmap": [ + "php/WP_Mock.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "description": "A mocking library to take the pain out of unit testing for WordPress", + "support": { + "issues": "https://github.com/10up/wp_mock/issues", + "source": "https://github.com/10up/wp_mock/tree/master" + }, + "time": "2019-03-16T03:44:39+00:00" + }, + { + "name": "antecedent/patchwork", + "version": "2.1.28", + "source": { + "type": "git", + "url": "https://github.com/antecedent/patchwork.git", + "reference": "6b30aff81ebadf0f2feb9268d3e08385cebcc08d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/6b30aff81ebadf0f2feb9268d3e08385cebcc08d", + "reference": "6b30aff81ebadf0f2feb9268d3e08385cebcc08d", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignas Rudaitis", + "email": "ignas.rudaitis@gmail.com" + } + ], + "description": "Method redefinition (monkey-patching) functionality for PHP.", + "homepage": "https://antecedent.github.io/patchwork/", + "keywords": [ + "aop", + "aspect", + "interception", + "monkeypatching", + "redefinition", + "runkit", + "testing" + ], + "support": { + "issues": "https://github.com/antecedent/patchwork/issues", + "source": "https://github.com/antecedent/patchwork/tree/2.1.28" + }, + "time": "2024-02-06T09:26:11+00:00" + }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v1.0.0", @@ -207,81 +495,440 @@ "time": "2023-01-05T11:28:13+00:00" }, { - "name": "newfold-labs/wp-php-standards", - "version": "1.2.2", + "name": "doctrine/instantiator", + "version": "1.5.0", "source": { "type": "git", - "url": "https://github.com/newfold-labs/wp-php-standards.git", - "reference": "e97e34d7d2df0cefdcb6f3c06714aae417b26044" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-php-standards/zipball/e97e34d7d2df0cefdcb6f3c06714aae417b26044", - "reference": "e97e34d7d2df0cefdcb6f3c06714aae417b26044", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "@stable", - "phpcompatibility/phpcompatibility-wp": "@stable", - "squizlabs/php_codesniffer": "@stable", - "wp-coding-standards/wpcs": "@stable" + "php": "^7.1 || ^8.0" }, - "type": "phpcodesniffer-standard", + "require-dev": { + "doctrine/coding-standard": "^9 || ^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", "license": [ - "GPL-2.0-or-later" + "MIT" ], "authors": [ { - "name": "Micah Wood", - "email": "micah@wpscholar.com" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" } ], - "description": "PHP Code Sniffer Standards for Newfold WordPress projects.", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], "support": { - "source": "https://github.com/newfold-labs/wp-php-standards/tree/1.2.2", - "issues": "https://github.com/newfold-labs/wp-php-standards/issues" + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, - "time": "2023-01-06T11:45:52+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:15:36+00:00" }, { - "name": "phpcompatibility/php-compatibility", - "version": "9.3.5", + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", "shasum": "" }, "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + "php": "^5.3|^7.0|^8.0" }, - "conflict": { - "squizlabs/php_codesniffer": "2.6.2" + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" }, "require-dev": { - "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" }, - "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", - "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] }, - "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL-3.0-or-later" + "BSD-3-Clause" ], - "authors": [ - { - "name": "Wim Godden", - "homepage": "https://github.com/wimg", - "role": "lead" - }, + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, + "time": "2020-07-09T08:09:16+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.3.6", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "dc206df4fa314a50bbb81cf72239a305c5bbd5c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/dc206df4fa314a50bbb81cf72239a305c5bbd5c0", + "reference": "dc206df4fa314a50bbb81cf72239a305c5bbd5c0", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.6" + }, + "time": "2022-09-07T15:05:49+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "newfold-labs/wp-php-standards", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-php-standards.git", + "reference": "e97e34d7d2df0cefdcb6f3c06714aae417b26044" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-php-standards/zipball/e97e34d7d2df0cefdcb6f3c06714aae417b26044", + "reference": "e97e34d7d2df0cefdcb6f3c06714aae417b26044", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "@stable", + "phpcompatibility/phpcompatibility-wp": "@stable", + "squizlabs/php_codesniffer": "@stable", + "wp-coding-standards/wpcs": "@stable" + }, + "type": "phpcodesniffer-standard", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "PHP Code Sniffer Standards for Newfold WordPress projects.", + "support": { + "source": "https://github.com/newfold-labs/wp-php-standards/tree/1.2.2", + "issues": "https://github.com/newfold-labs/wp-php-standards/issues" + }, + "time": "2023-01-06T11:45:52+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/master" + }, + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, { "name": "Juliette Reinders Folmer", "homepage": "https://github.com/jrfnl", @@ -584,70 +1231,1340 @@ "time": "2023-12-08T14:50:00+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "name": "phpdocumentor/reflection-common", + "version": "2.1.0", "source": { "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + "php": ">=7.1" }, - "bin": [ - "bin/phpcbf", - "bin/phpcs" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Greg Sherwood", - "role": "Former lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "Current lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", "keywords": [ - "phpcs", - "standards", + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", "static analysis" ], "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" }, - "funding": [ + "time": "2020-04-27T09:25:28+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "^1.0.5", + "mockery/mockery": "^1.0", + "phpdocumentor/type-resolver": "0.4.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x" + }, + "time": "2019-12-28T18:55:12+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "shasum": "" + }, + "require": { + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/0.7.2" + }, + "time": "2019-08-22T18:11:29+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.10.3", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "451c3cd1418cf640de218914901e51b064abb093" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" + }, + "time": "2020-03-05T15:02:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + }, + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:42:26+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2021-07-26T12:15:06+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.20", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + }, + "time": "2020-01-08T08:45:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:31:48+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6296a0c086dd0117c1b78b059374d7fcbe7545ae", + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-05-07T05:30:20+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:00:17+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + }, + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:30:19+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.8.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ { "url": "https://github.com/PHPCSStandards", "type": "github" @@ -663,6 +2580,182 @@ ], "time": "2024-01-11T20:47:48+00:00" }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, + "time": "2020-07-08T17:02:28+00:00" + }, { "name": "wp-coding-standards/wpcs", "version": "3.0.1", @@ -740,5 +2833,5 @@ "platform-overrides": { "php": "7.1" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/patchwork.json b/patchwork.json new file mode 100644 index 0000000..cd1e2da --- /dev/null +++ b/patchwork.json @@ -0,0 +1,5 @@ +{ + "redefinable-internals": [ + "constant" + ] +} \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..d911594 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,17 @@ + + + + + + + + tests/phpunit + + + diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php new file mode 100644 index 0000000..6c4e4bc --- /dev/null +++ b/tests/phpunit/bootstrap.php @@ -0,0 +1,24 @@ + Date: Fri, 16 Feb 2024 14:22:22 -0800 Subject: [PATCH 02/13] Add `server_path` to `get_core_data()` using `ABSPATH` --- includes/HiiveConnection.php | 3 +- .../phpunit/includes/HiiveConnectionTest.php | 89 +++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 tests/phpunit/includes/HiiveConnectionTest.php diff --git a/includes/HiiveConnection.php b/includes/HiiveConnection.php index b3297ee..3ff0af2 100644 --- a/includes/HiiveConnection.php +++ b/includes/HiiveConnection.php @@ -269,7 +269,7 @@ public function get_core_data() { 'brand' => sanitize_title( $container->plugin()->brand ), 'cache_level' => intval( get_option( 'newfold_cache_level', 2 ) ), 'cloudflare' => get_option( 'newfold_cloudflare_enabled', false ), - 'data' => NFD_DATA_MODULE_VERSION, + 'data' => defined('NFD_DATA_MODULE_VERSION' ) ? constant( 'NFD_DATA_MODULE_VERSION' ) : '0.0', 'email' => get_option( 'admin_email' ), 'hostname' => gethostname(), 'mysql' => $wpdb->db_version(), @@ -279,6 +279,7 @@ public function get_core_data() { 'url' => get_site_url(), 'username' => get_current_user(), 'wp' => $wp_version, + 'server_path' => defined('ABSPATH' ) ? constant( 'ABSPATH' ) : '', ); return apply_filters( 'newfold_wp_data_module_core_data_filter', $data ); diff --git a/tests/phpunit/includes/HiiveConnectionTest.php b/tests/phpunit/includes/HiiveConnectionTest.php new file mode 100644 index 0000000..e156ece --- /dev/null +++ b/tests/phpunit/includes/HiiveConnectionTest.php @@ -0,0 +1,89 @@ +brand = 'bluehost'; + $plugin->expects('get')->once()->with('id', 'error')->andReturn('bluehost'); + $plugin->expects('get')->once()->with('version', '0')->andReturn('1.2.3'); + container()->set('plugin', $plugin); + + WP_Mock::passthruFunction('sanitize_title'); + + WP_Mock::userFunction('get_option')->once()->with('newfold_cache_level', 2)->andReturn(2); + WP_Mock::userFunction('get_option')->once()->with('newfold_cloudflare_enabled', false)->andReturn(false); + WP_Mock::userFunction('get_option')->once()->with('admin_email')->andReturn('admin@example.com'); + WP_Mock::userFunction('get_site_url')->once()->withNoArgs()->andReturn('http://example.com'); + +// WP_Mock::expectFilter('newfold_wp_data_module_core_data_filter'); + + global $wpdb; + $wpdb = Mockery::mock(); + $wpdb->expects('db_version')->once()->andReturn('1.2.3'); + + $sut = new HiiveConnection(); + + $result = $sut->get_core_data(); + + self::assertArrayHasKey('hostname', $result); + } + /** + * @covers ::get_core_data + */ + public function test_plugin_sends_server_path_to_hiive(): void + { +// WP_Mock::expectAction('newfold_container_set'); + + $plugin = Mockery::mock(Plugin::class); + $plugin->brand = 'bluehost'; + $plugin->expects('get')->once()->with('id', 'error')->andReturn('bluehost'); + $plugin->expects('get')->once()->with('version', '0')->andReturn('1.2.3'); + container()->set('plugin', $plugin); + + WP_Mock::passthruFunction('sanitize_title'); + + WP_Mock::userFunction('get_option')->once()->with('newfold_cache_level', 2)->andReturn(2); + WP_Mock::userFunction('get_option')->once()->with('newfold_cloudflare_enabled', false)->andReturn(false); + WP_Mock::userFunction('get_option')->once()->with('admin_email')->andReturn('admin@example.com'); + WP_Mock::userFunction('get_site_url')->once()->withNoArgs()->andReturn('http://example.com'); + +// WP_Mock::expectFilter('newfold_wp_data_module_core_data_filter'); + + global $wpdb; + $wpdb = Mockery::mock(); + $wpdb->expects('db_version')->once()->andReturn('1.2.3'); + + \Patchwork\redefine( + 'constant', + function ( string $constant_name ): string { + return 'ABSPATH' === $constant_name + ? '/path/on/server/' + : \Patchwork\relay(func_get_args()); + } + ); + + $sut = new HiiveConnection(); + + $result = $sut->get_core_data(); + + self::assertArrayHasKey('server_path', $result); + self::assertEquals('/path/on/server/', $result['server_path']); + } +} \ No newline at end of file From 11ce728d6748f63b4b979db412d20109d0dd0d73 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Fri, 16 Feb 2024 14:25:27 -0800 Subject: [PATCH 03/13] Linting/spacing --- includes/HiiveConnection.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/HiiveConnection.php b/includes/HiiveConnection.php index 3ff0af2..20028d8 100644 --- a/includes/HiiveConnection.php +++ b/includes/HiiveConnection.php @@ -268,8 +268,8 @@ public function get_core_data() { $data = array( 'brand' => sanitize_title( $container->plugin()->brand ), 'cache_level' => intval( get_option( 'newfold_cache_level', 2 ) ), - 'cloudflare' => get_option( 'newfold_cloudflare_enabled', false ), - 'data' => defined('NFD_DATA_MODULE_VERSION' ) ? constant( 'NFD_DATA_MODULE_VERSION' ) : '0.0', + 'cloudflare' => get_option( 'newfold_cloudflare_enabled', false ), + 'data' => defined( 'NFD_DATA_MODULE_VERSION' ) ? constant( 'NFD_DATA_MODULE_VERSION' ) : '0.0', 'email' => get_option( 'admin_email' ), 'hostname' => gethostname(), 'mysql' => $wpdb->db_version(), @@ -279,7 +279,7 @@ public function get_core_data() { 'url' => get_site_url(), 'username' => get_current_user(), 'wp' => $wp_version, - 'server_path' => defined('ABSPATH' ) ? constant( 'ABSPATH' ) : '', + 'server_path' => defined( 'ABSPATH' ) ? constant( 'ABSPATH' ) : '', ); return apply_filters( 'newfold_wp_data_module_core_data_filter', $data ); From 95dfe211817e2d9dfffe5d94337dd1ed9c557fb6 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Fri, 16 Feb 2024 14:35:07 -0800 Subject: [PATCH 04/13] delete useless autogen comment --- tests/phpunit/bootstrap.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 6c4e4bc..70591e5 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -3,9 +3,6 @@ /** * I was having trouble with {@see WP_Mock::expectAction()} so mocked it here. Because we're using PHP 7.1, we're * not on the latest version of WP_Mock, which requires 7.4. - * - * @param ...$args - * @return void */ function do_action(...$args) {} function apply_filters(...$args) { return $args[1]; } From b3a0f2c18a123c81198afcb99937efd1b581ea89 Mon Sep 17 00:00:00 2001 From: Mamatha Rao Date: Wed, 6 Mar 2024 17:40:07 +0530 Subject: [PATCH 05/13] Fixed the deprecated warning from wp-module-data module --- includes/Listeners/Commerce.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/Listeners/Commerce.php b/includes/Listeners/Commerce.php index 4197bca..b64434a 100644 --- a/includes/Listeners/Commerce.php +++ b/includes/Listeners/Commerce.php @@ -61,7 +61,9 @@ public function products_count( $data ) { if ( ! isset( $data['meta'] ) ) { $data['meta'] = array(); } - $data['meta']['products_count'] = (int) wp_count_posts( 'product' )->publish; + if(isset(wp_count_posts( 'product' )->publish)){ + $data['meta']['products_count'] = (int) wp_count_posts( 'product' )->publish; + } return $data; } @@ -77,7 +79,9 @@ public function orders_count( $data ) { if ( ! isset( $data['meta'] ) ) { $data['meta'] = array(); } - $data['meta']['orders_count'] = (int) wp_count_posts( 'shop_order' )->publish; + if(isset(wp_count_posts( 'shop_order' )->publish)){ + $data['meta']['orders_count'] = (int) wp_count_posts( 'shop_order' )->publish; + } return $data; } From 82943551b3332b3a5aaa88ece0c140d084729770 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Thu, 7 Mar 2024 16:09:29 +0530 Subject: [PATCH 06/13] passing only the array keys instead of entire values --- includes/Listeners/Commerce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Listeners/Commerce.php b/includes/Listeners/Commerce.php index 4197bca..692488a 100644 --- a/includes/Listeners/Commerce.php +++ b/includes/Listeners/Commerce.php @@ -113,7 +113,7 @@ public function checkout_views() { "product_count" => WC()->cart->get_cart_contents_count(), "cart_total" => floatval(WC()->cart->get_cart_contents_total()), "currency" => get_woocommerce_currency(), - "payment_method" => WC()->payment_gateways()->get_available_payment_gateways() + "payment_method" => array_keys( WC()->payment_gateways()->get_available_payment_gateways() ) ); $this->push( From 09b85b18340c662a9303b5eb3efcd0eabb14fb38 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Thu, 7 Mar 2024 16:12:26 +0530 Subject: [PATCH 07/13] fixing linting issues --- includes/Listeners/Commerce.php | 184 ++++++++++++++++---------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/includes/Listeners/Commerce.php b/includes/Listeners/Commerce.php index 692488a..11aceac 100644 --- a/includes/Listeners/Commerce.php +++ b/includes/Listeners/Commerce.php @@ -16,24 +16,24 @@ public function register_hooks() { add_action( 'woocommerce_order_status_processing', array( $this, 'on_payment' ), 10, 2 ); add_filter( 'newfold_wp_data_module_cron_data_filter', array( $this, 'products_count' ) ); add_filter( 'newfold_wp_data_module_cron_data_filter', array( $this, 'orders_count' ) ); - add_filter('woocommerce_before_cart', array( $this, 'site_cart_views')); - add_filter('woocommerce_before_checkout_form', array( $this, 'checkout_views')); - add_filter('woocommerce_thankyou', array( $this, 'thank_you_page')); + add_filter( 'woocommerce_before_cart', array( $this, 'site_cart_views' ) ); + add_filter( 'woocommerce_before_checkout_form', array( $this, 'checkout_views' ) ); + add_filter( 'woocommerce_thankyou', array( $this, 'thank_you_page' ) ); add_filter( 'pre_update_option_nfd_ecommerce_captive_flow_razorpay', array( $this, 'razorpay_connection' ), 10, 2 ); add_filter( 'pre_update_option_nfd_ecommerce_captive_flow_shippo', array( $this, 'shippo_connection' ), 10, 2 ); add_filter( 'pre_update_option_nfd_ecommerce_captive_flow_stripe', array( $this, 'stripe_connection' ), 10, 2 ); // Paypal Connection add_filter( 'pre_update_option_yith_ppwc_merchant_data_production', array( $this, 'paypal_connection' ), 10, 2 ); - add_filter('update_option_ewc4wp_sso_account_status', array($this, 'ecomdash_connected')); + add_filter( 'update_option_ewc4wp_sso_account_status', array( $this, 'ecomdash_connected' ) ); add_filter( 'woocommerce_update_product', array( $this, 'product_created_or_updated' ), 100, 2 ); - add_action('update_option_woocommerce_custom_orders_table_enabled', array($this, 'woocommerce_hpos_enabled'), 10, 3 ); + add_action( 'update_option_woocommerce_custom_orders_table_enabled', array( $this, 'woocommerce_hpos_enabled' ), 10, 3 ); } /** * On Payment, send data to Hiive * - * @param int $order_id - * @param \WC_Order $order + * @param int $order_id + * @param \WC_Order $order * * @return void */ @@ -47,13 +47,12 @@ public function on_payment( $order_id, \WC_Order $order ) { ); $this->push( 'woocommerce_order_status_processing', $data ); - } /** * Products Count * - * @param string $data Array of data to be sent to Hiive + * @param string $data Array of data to be sent to Hiive * * @return string Array of data */ @@ -69,7 +68,7 @@ public function products_count( $data ) { /** * Orders Count * - * @param string $data Array of data to be sent to Hiive + * @param string $data Array of data to be sent to Hiive * * @return string Array of data */ @@ -88,17 +87,17 @@ public function orders_count( $data ) { * @return void */ public function site_cart_views() { - if( WC()->cart->get_cart_contents_count() !== 0){ - $data = array( - "product_count" => WC()->cart->get_cart_contents_count(), - "cart_total" => floatval(WC()->cart->get_cart_contents_total()), - "currency" => get_woocommerce_currency(), - ); + if ( WC()->cart->get_cart_contents_count() !== 0 ) { + $data = array( + 'product_count' => WC()->cart->get_cart_contents_count(), + 'cart_total' => floatval( WC()->cart->get_cart_contents_total() ), + 'currency' => get_woocommerce_currency(), + ); - $this->push( - "site_cart_view", - $data - ); + $this->push( + 'site_cart_view', + $data + ); } } @@ -110,14 +109,14 @@ public function site_cart_views() { */ public function checkout_views() { $data = array( - "product_count" => WC()->cart->get_cart_contents_count(), - "cart_total" => floatval(WC()->cart->get_cart_contents_total()), - "currency" => get_woocommerce_currency(), - "payment_method" => array_keys( WC()->payment_gateways()->get_available_payment_gateways() ) + 'product_count' => WC()->cart->get_cart_contents_count(), + 'cart_total' => floatval( WC()->cart->get_cart_contents_total() ), + 'currency' => get_woocommerce_currency(), + 'payment_method' => array_keys( WC()->payment_gateways()->get_available_payment_gateways() ), ); $this->push( - "site_checkout_view", + 'site_checkout_view', $data ); } @@ -125,12 +124,12 @@ public function checkout_views() { /** * Thank you page, send data to Hiive * - * @param int $order_id + * @param int $order_id * * @return void */ - public function thank_you_page($order_id ) { - $order = wc_get_order( $order_id ); + public function thank_you_page( $order_id ) { + $order = wc_get_order( $order_id ); $line_items = $order->get_items(); // This loops over line items @@ -138,13 +137,13 @@ public function thank_you_page($order_id ) { $qty = $item['qty']; } $data = array( - "product_count" => $qty, - "order_total" => floatval($order->get_total()), - "currency" => get_woocommerce_currency(), + 'product_count' => $qty, + 'order_total' => floatval( $order->get_total() ), + 'currency' => get_woocommerce_currency(), ); $this->push( - "site_thank_you_view", + 'site_thank_you_view', $data ); } @@ -158,16 +157,16 @@ public function thank_you_page($order_id ) { * @return string The new option value */ public function razorpay_connection( $new_option, $old_option ) { - $url = is_ssl() ? "https://" : "http://"; + $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $data = array( - "label_key" => "provider", - "provider" => "razorpay", - "page" => $url + 'label_key' => 'provider', + 'provider' => 'razorpay', + 'page' => $url, ); if ( $new_option !== $old_option && ! empty( $new_option ) ) { $this->push( - "payment_connected", + 'payment_connected', $data ); } @@ -184,16 +183,16 @@ public function razorpay_connection( $new_option, $old_option ) { * @return string The new option value */ public function shippo_connection( $new_option, $old_option ) { - $url = is_ssl() ? "https://" : "http://"; + $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $data = array( - "label_key" => "provider", - "provider" => "shippo", - "page" => $url + 'label_key' => 'provider', + 'provider' => 'shippo', + 'page' => $url, ); if ( $new_option !== $old_option && ! empty( $new_option ) ) { $this->push( - "shipping_connected", + 'shipping_connected', $data ); } @@ -210,16 +209,16 @@ public function shippo_connection( $new_option, $old_option ) { * @return string The new option value */ public function stripe_connection( $new_option, $old_option ) { - $url = is_ssl() ? "https://" : "http://"; + $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $data = array( - "label_key" => "provider", - "provider" => "stripe", - "page" => $url + 'label_key' => 'provider', + 'provider' => 'stripe', + 'page' => $url, ); if ( $new_option !== $old_option && ! empty( $new_option ) ) { $this->push( - "payment_connected", + 'payment_connected', $data ); } @@ -236,16 +235,16 @@ public function stripe_connection( $new_option, $old_option ) { * @return string The new option value */ public function paypal_connection( $new_option, $old_option ) { - $url = is_ssl() ? "https://" : "http://"; + $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $data = array( - "label_key" => "provider", - "provider" => "yith_paypal", - "page" => $url + 'label_key' => 'provider', + 'provider' => 'yith_paypal', + 'page' => $url, ); if ( $new_option !== $old_option && ! empty( $new_option ) ) { $this->push( - "payment_connected", + 'payment_connected', $data ); } @@ -261,66 +260,67 @@ public function paypal_connection( $new_option, $old_option ) { * * @return string The new option value */ - public function ecomdash_connected($new_option, $old_option) { + public function ecomdash_connected( $new_option, $old_option ) { if ( $new_option !== $old_option && ! empty( $new_option ) && $new_option === 'connected' ) { - $url = is_ssl() ? "https://" : "http://"; + $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $data = array( - "url" => $url + 'url' => $url, ); $this->push( - "ecomdash_connected", + 'ecomdash_connected', $data ); - } + } return $new_option; } /** - * Product added, send data to Hiive - * @param string $product_id id of post which is being savedPost ObjectOld value of the yith_ppwc_merchant_data_production option - * @param WP_POST $product details of the product - * @return void - */ - public function product_created_or_updated($product_id, $product) { - $data = array( - "label_key" => "product_type", - "product_type" => $product->product_type, - "post_id" => $product_id - ); - - $this->push( - "product_created", - $data - ); - } + * Product added, send data to Hiive + * + * @param string $product_id id of post which is being savedPost ObjectOld value of the yith_ppwc_merchant_data_production option + * @param WP_POST $product details of the product + * @return void + */ + public function product_created_or_updated( $product_id, $product ) { + $data = array( + 'label_key' => 'product_type', + 'product_type' => $product->product_type, + 'post_id' => $product_id, + ); + + $this->push( + 'product_created', + $data + ); + } /** - * HPOS (High Performance Order Storage) is enabled - * Send data to hiive - - * @param string $old_value Old value of woocommerce_custom_orders_table_enabled - * @param string $new_value New value of woocommerce_custom_orders_table_enabled - * @param option name of the option being updated - - * @return void - */ - public function woocommerce_hpos_enabled($old_value, $new_value, $option) { - if ( $new_value !== $old_value && ! empty( $new_value )) { - $url = is_ssl() ? "https://" : "http://"; + * HPOS (High Performance Order Storage) is enabled + * Send data to hiive + + * @param string $old_value Old value of woocommerce_custom_orders_table_enabled + * @param string $new_value New value of woocommerce_custom_orders_table_enabled + * @param option name of the option being updated + + * @return void + */ + public function woocommerce_hpos_enabled( $old_value, $new_value, $option ) { + if ( $new_value !== $old_value && ! empty( $new_value ) ) { + $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - $type = ($new_value === 'yes') ? 'hpos':'legacy'; + $type = ( $new_value === 'yes' ) ? 'hpos' : 'legacy'; $data = array( - "label_key" => $option, - "type" => $type, - "page" => $url + 'label_key' => $option, + 'type' => $type, + 'page' => $url, ); $this->push( - "changed_woo_order_storage_type", + 'changed_woo_order_storage_type', $data ); } - } + } } From 06081971c435b78457d4a02cd389550256cfc94d Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Tue, 12 Mar 2024 14:38:17 -0700 Subject: [PATCH 08/13] Require `wp-forge/helpers` --- composer.json | 1 + composer.lock | 142 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 142 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0d18f4e..60c1fa1 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,7 @@ }, "require": { "newfold-labs/wp-module-loader": "^1.0", + "wp-forge/helpers": "^2.0", "wp-forge/wp-query-builder": "^1.0", "wp-forge/wp-upgrade-handler": "^1.0", "wpscholar/url": "^1.2" diff --git a/composer.lock b/composer.lock index 0f37edf..ac7696b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,104 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f248eda5612deab791ab1f8c891ea3f5", + "content-hash": "31502efef0bb51e978bafa8b00739bbb", "packages": [ + { + "name": "doctrine/inflector", + "version": "1.4.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", + "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector", + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/1.4.4" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2021-04-16T17:34:40+00:00" + }, { "name": "newfold-labs/container", "version": "1.2.2", @@ -164,6 +260,50 @@ }, "time": "2022-08-26T17:38:37+00:00" }, + { + "name": "wp-forge/helpers", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/wp-forge/helpers.git", + "reference": "28ebc09a3390dbff427270a4ed2b93395e8b9b78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-forge/helpers/zipball/28ebc09a3390dbff427270a4ed2b93395e8b9b78", + "reference": "28ebc09a3390dbff427270a4ed2b93395e8b9b78", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.3", + "ext-mbstring": "*" + }, + "type": "library", + "autoload": { + "files": [ + "includes/functions.php" + ], + "psr-4": { + "WP_Forge\\Helpers\\": "includes" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah@wpscholar.com" + } + ], + "description": "A collection of helpers for WordPress and PHP development.", + "support": { + "issues": "https://github.com/wp-forge/helpers/issues", + "source": "https://github.com/wp-forge/helpers/tree/2.0" + }, + "time": "2022-01-06T13:10:47+00:00" + }, { "name": "wp-forge/wp-options", "version": "1.1", From 69f811c05ffc5daf30b264050a6edb8839ff8ca5 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Tue, 12 Mar 2024 14:39:04 -0700 Subject: [PATCH 09/13] `use function WP_Forge\Helpers\dataGet;` Fix #61 --- includes/Data.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/Data.php b/includes/Data.php index ad019cf..3662fe2 100644 --- a/includes/Data.php +++ b/includes/Data.php @@ -3,6 +3,7 @@ namespace NewfoldLabs\WP\Module\Data; use wpscholar\Url; +use function WP_Forge\Helpers\dataGet; /** * Main class for the data plugin module @@ -128,7 +129,7 @@ public function authenticate( $status ) { 'method' => $_SERVER['REQUEST_METHOD'], 'url' => Url::getCurrentUrl(), 'body' => file_get_contents( 'php://input' ), - 'timestamp' => data_get( getallheaders(), 'X-Timestamp' ), + 'timestamp' => dataGet( getallheaders(), 'X-Timestamp' ), ); $hash = hash( 'sha256', wp_json_encode( $data ) ); From 2fd8f86e5ed43568355ea1e584839643f3ff45e2 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 13 Mar 2024 12:44:35 -0400 Subject: [PATCH 10/13] some lint fixes --- includes/Listeners/Commerce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Listeners/Commerce.php b/includes/Listeners/Commerce.php index f2411ce..7db400c 100644 --- a/includes/Listeners/Commerce.php +++ b/includes/Listeners/Commerce.php @@ -60,7 +60,7 @@ public function products_count( $data ) { if ( ! isset( $data['meta'] ) ) { $data['meta'] = array(); } - if(isset(wp_count_posts( 'product' )->publish)){ + if( isset( wp_count_posts( 'product' )->publish ) ) { $data['meta']['products_count'] = (int) wp_count_posts( 'product' )->publish; } @@ -78,7 +78,7 @@ public function orders_count( $data ) { if ( ! isset( $data['meta'] ) ) { $data['meta'] = array(); } - if(isset(wp_count_posts( 'shop_order' )->publish)){ + if( isset( wp_count_posts( 'shop_order' )->publish ) ) { $data['meta']['orders_count'] = (int) wp_count_posts( 'shop_order' )->publish; } From 1b1b0dd516ec8cb38c91583c0be6444769f94971 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 13 Mar 2024 13:29:57 -0400 Subject: [PATCH 11/13] more lint fixes --- includes/Listeners/Commerce.php | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/includes/Listeners/Commerce.php b/includes/Listeners/Commerce.php index 7db400c..99f3438 100644 --- a/includes/Listeners/Commerce.php +++ b/includes/Listeners/Commerce.php @@ -32,8 +32,8 @@ public function register_hooks() { /** * On Payment, send data to Hiive * - * @param int $order_id - * @param \WC_Order $order + * @param int $order_id the order id + * @param \WC_Order $order the order * * @return void */ @@ -60,7 +60,7 @@ public function products_count( $data ) { if ( ! isset( $data['meta'] ) ) { $data['meta'] = array(); } - if( isset( wp_count_posts( 'product' )->publish ) ) { + if ( isset( wp_count_posts( 'product' )->publish ) ) { $data['meta']['products_count'] = (int) wp_count_posts( 'product' )->publish; } @@ -78,7 +78,7 @@ public function orders_count( $data ) { if ( ! isset( $data['meta'] ) ) { $data['meta'] = array(); } - if( isset( wp_count_posts( 'shop_order' )->publish ) ) { + if ( isset( wp_count_posts( 'shop_order' )->publish ) ) { $data['meta']['orders_count'] = (int) wp_count_posts( 'shop_order' )->publish; } @@ -128,7 +128,7 @@ public function checkout_views() { /** * Thank you page, send data to Hiive * - * @param int $order_id + * @param int $order_id the order id * * @return void */ @@ -155,8 +155,8 @@ public function thank_you_page( $order_id ) { /** * Razorpay connected * - * @param string $new_option New value of the razorpay_data_production option - * @param string $old_option Old value of the razorpay_data_production option + * @param string $new_option New value of the razorpay_data_production option + * @param string $old_option Old value of the razorpay_data_production option * * @return string The new option value */ @@ -181,8 +181,8 @@ public function razorpay_connection( $new_option, $old_option ) { /** * Shippo connected * - * @param string $new_option New value of the shippo_data option - * @param string $old_option Old value of the shippo_data option + * @param string $new_option New value of the shippo_data option + * @param string $old_option Old value of the shippo_data option * * @return string The new option value */ @@ -207,8 +207,8 @@ public function shippo_connection( $new_option, $old_option ) { /** * Stripe connected * - * @param string $new_option New value of the stripe_data_production option - * @param string $old_option Old value of the stripe_data_production option + * @param string $new_option New value of the stripe_data_production option + * @param string $old_option Old value of the stripe_data_production option * * @return string The new option value */ @@ -233,8 +233,8 @@ public function stripe_connection( $new_option, $old_option ) { /** * PayPal connected * - * @param string $new_option New value of the yith_ppwc_merchant_data_production option - * @param string $old_option Old value of the yith_ppwc_merchant_data_production option + * @param string $new_option New value of the yith_ppwc_merchant_data_production option + * @param string $old_option Old value of the yith_ppwc_merchant_data_production option * * @return string The new option value */ @@ -259,13 +259,13 @@ public function paypal_connection( $new_option, $old_option ) { /** * Ecomdash connection, send data to Hiive * - * @param string $new_option New value of the update_option_ewc4wp_sso_account_status option - * @param string $old_option Old value of the update_option_ewc4wp_sso_account_status option + * @param string $new_option New value of the update_option_ewc4wp_sso_account_status option + * @param string $old_option Old value of the update_option_ewc4wp_sso_account_status option * * @return string The new option value */ public function ecomdash_connected( $new_option, $old_option ) { - if ( $new_option !== $old_option && ! empty( $new_option ) && $new_option === 'connected' ) { + if ( $new_option !== $old_option && ! empty( $new_option ) && 'connected' === $new_option ) { $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $data = array( @@ -282,8 +282,8 @@ public function ecomdash_connected( $new_option, $old_option ) { /** * Product added, send data to Hiive * - * @param string $product_id id of post which is being savedPost ObjectOld value of the yith_ppwc_merchant_data_production option - * @param WP_POST $product details of the product + * @param string $product_id id of post which is being savedPost ObjectOld value of the yith_ppwc_merchant_data_production option + * @param WP_POST $product details of the product * @return void */ public function product_created_or_updated( $product_id, $product ) { @@ -303,9 +303,9 @@ public function product_created_or_updated( $product_id, $product ) { * HPOS (High Performance Order Storage) is enabled * Send data to hiive - * @param string $old_value Old value of woocommerce_custom_orders_table_enabled - * @param string $new_value New value of woocommerce_custom_orders_table_enabled - * @param option name of the option being updated + * @param string $old_value Old value of woocommerce_custom_orders_table_enabled + * @param string $new_value New value of woocommerce_custom_orders_table_enabled + * @param string $option name of the option being updated * @return void */ @@ -313,7 +313,7 @@ public function woocommerce_hpos_enabled( $old_value, $new_value, $option ) { if ( $new_value !== $old_value && ! empty( $new_value ) ) { $url = is_ssl() ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - $type = ( $new_value === 'yes' ) ? 'hpos' : 'legacy'; + $type = ( 'yes' === $new_value ) ? 'hpos' : 'legacy'; $data = array( 'label_key' => $option, From fe91dd643298da245deb8bb116a2d76415f969ef Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 13 Mar 2024 14:31:28 -0400 Subject: [PATCH 12/13] add brand plugin test workflow --- .github/workflows/brand-plugin-test.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/brand-plugin-test.yml diff --git a/.github/workflows/brand-plugin-test.yml b/.github/workflows/brand-plugin-test.yml new file mode 100644 index 0000000..e69de29 From 50c36f59ea63d8af58c3d74f074ae2df2f5d43e4 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 13 Mar 2024 14:40:41 -0400 Subject: [PATCH 13/13] commit workflow contents --- .github/workflows/brand-plugin-test.yml | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/.github/workflows/brand-plugin-test.yml b/.github/workflows/brand-plugin-test.yml index e69de29..553c827 100644 --- a/.github/workflows/brand-plugin-test.yml +++ b/.github/workflows/brand-plugin-test.yml @@ -0,0 +1,78 @@ +name: Build and Test Updates in Plugins +on: + pull_request: + types: [ opened, reopened, ready_for_review, synchronize ] + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.extract_branch.outputs.branch }} + steps: + + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + + bluehost: + name: Bluehost Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'bluehost/bluehost-wordpress-plugin' + secrets: inherit + + hostgator: + name: HostGator Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-hostgator' + node-version: 20 + secrets: inherit + + web: + name: Web.com Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-web' + node-version: 20 + secrets: inherit + + crazydomains: + name: Crazy Domains Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-crazy-domains' + node-version: 20 + secrets: inherit + + mojo: + name: Mojo Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-mojo' + node-version: 20 + secrets: inherit