From b7a122d4581189e0ebf02123737552e9c9fded32 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:09:00 +0100 Subject: [PATCH 01/16] Try test --- .github/workflows/deploy.yml | 4 +- .github/workflows/phpunit.yml | 90 + composer.json | 9 +- composer.lock | 2527 +++++++++++++++-- phpunit.xml.dist | 15 + tests/bin/install-wp-tests.sh | 181 ++ tests/bootstrap.php | 38 + .../helper-functions/test-class-admin.php | 39 + 8 files changed, 2692 insertions(+), 211 deletions(-) create mode 100644 .github/workflows/phpunit.yml create mode 100644 phpunit.xml.dist create mode 100755 tests/bin/install-wp-tests.sh create mode 100644 tests/bootstrap.php create mode 100644 tests/phpunit/helper-functions/test-class-admin.php diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f2860eb..404b19c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,10 +25,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Create Release id: create_release - uses: actions/create-release@v1 + uses: avakar/tag-and-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token with: diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000..4363c6c --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,90 @@ +name: Test + +on: + # Run on pushes to select branches and on all pull requests. + push: + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + integration: + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - php_version: '8.1' + wp_version: '6.2' + multisite: false + + - php_version: '8.1' + wp_version: 'latest' + multisite: false + + - php_version: '8.1' + wp_version: 'latest' + multisite: true + + - php_version: '8.2' + wp_version: 'latest' + multisite: true + + name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}" + + # Allow builds to fail on as-of-yet unreleased WordPress versions. + continue-on-error: ${{ matrix.wp_version == 'trunk' }} + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_version }} + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On + coverage: none + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: "Composer: remove the PHP platform requirement" + run: composer config --unset platform.php + + - name: "Install Composer dependencies" + uses: ramsey/composer-install@v2 + with: + # Force a `composer update` run. + dependency-versions: "highest" + # But make it selective. + composer-options: "yoast/wp-test-utils --with-dependencies" + # Bust the cache at least once a month - output format: YYYY-MM-DD. + custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + + - name: Install WP + shell: bash + run: tests/bin/install-wp-tests.sh wordpress_tests root '' 127.0.0.1:3306 ${{ matrix.wp_version }} + + - name: Run unit tests - single site + run: composer test + + - name: Run unit tests - multisite + if: ${{ matrix.multisite == true }} + run: composer test + env: + WP_MULTISITE: 1 diff --git a/composer.json b/composer.json index cf05b48..f9c0059 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,9 @@ "require-dev": { "wp-coding-standards/wpcs": "^3.0", "phpcompatibility/phpcompatibility-wp": "*", - "php-parallel-lint/php-parallel-lint": "^1.3" + "php-parallel-lint/php-parallel-lint": "^1.3", + "yoast/wp-test-utils": "^1.2", + "yoast/phpunit-polyfills": "^1.1" }, "scripts": { "check-cs": [ @@ -31,7 +33,10 @@ ], "lint-blueprint": [ "@php -r \"exit( intval( is_null( json_decode( file_get_contents( './.wordpress.org/blueprints/blueprint.json' ) ) ) ) );\"" - ] + ], + "test": [ + "@php ./vendor/phpunit/phpunit/phpunit" + ] }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 42ebb2a..7fc5255 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,127 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b7b717b87326b0479942b38471ef8aa6", + "content-hash": "0f832fa92feda90cadf8e053b301d8e1", "packages": [], "packages-dev": [ + { + "name": "antecedent/patchwork", + "version": "2.1.27", + "source": { + "type": "git", + "url": "https://github.com/antecedent/patchwork.git", + "reference": "16a1ab81559aabf14acb616141e801b32777f085" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/16a1ab81559aabf14acb616141e801b32777f085", + "reference": "16a1ab81559aabf14acb616141e801b32777f085", + "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.27" + }, + "time": "2023-12-03T18:46:49+00:00" + }, + { + "name": "brain/monkey", + "version": "2.6.1", + "source": { + "type": "git", + "url": "https://github.com/Brain-WP/BrainMonkey.git", + "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/a31c84515bb0d49be9310f52ef1733980ea8ffbb", + "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb", + "shasum": "" + }, + "require": { + "antecedent/patchwork": "^2.1.17", + "mockery/mockery": "^1.3.5 || ^1.4.4", + "php": ">=5.6.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", + "phpcompatibility/php-compatibility": "^9.3.0", + "phpunit/phpunit": "^5.7.26 || ^6.0 || ^7.0 || >=8.0 <8.5.12 || ^8.5.14 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-version/1": "1.x-dev", + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "files": [ + "inc/api.php" + ], + "psr-4": { + "Brain\\Monkey\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Giuseppe Mazzapica", + "email": "giuseppe.mazzapica@gmail.com", + "homepage": "https://gmazzap.me", + "role": "Developer" + } + ], + "description": "Mocking utility for PHP functions and WordPress plugin API", + "keywords": [ + "Monkey Patching", + "interception", + "mock", + "mock functions", + "mockery", + "patchwork", + "redefinition", + "runkit", + "test", + "testing" + ], + "support": { + "issues": "https://github.com/Brain-WP/BrainMonkey/issues", + "source": "https://github.com/Brain-WP/BrainMonkey" + }, + "time": "2021-11-11T15:53:55+00:00" + }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v1.0.0", @@ -86,371 +204,2187 @@ "time": "2023-01-05T11:28:13+00:00" }, { - "name": "php-parallel-lint/php-parallel-lint", - "version": "v1.3.2", + "name": "doctrine/instantiator", + "version": "1.5.0", "source": { "type": "git", - "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", - "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6483c9832e71973ed29cf71bd6b3f4fde438a9de", - "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { - "ext-json": "*", - "php": ">=5.3.0" - }, - "replace": { - "grogy/php-parallel-lint": "*", - "jakub-onderka/php-parallel-lint": "*" + "php": "^7.1 || ^8.0" }, "require-dev": { - "nette/tester": "^1.3 || ^2.0", - "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", - "squizlabs/php_codesniffer": "^3.6" + "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" }, - "suggest": { - "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } }, - "bin": [ - "parallel-lint" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "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": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "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": "hamcrest/hamcrest-php", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0|^8.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "autoload": { "classmap": [ - "./src/" + "hamcrest" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-2-Clause" + "BSD-3-Clause" ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "ahoj@jakubonderka.cz" - } + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" ], - "description": "This tool check syntax of PHP files about 20x faster than serial check.", - "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", "support": { - "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", - "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.3.2" + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" }, - "time": "2022-02-21T12:50:22+00:00" + "time": "2020-07-09T08:09:16+00:00" }, { - "name": "phpcompatibility/php-compatibility", - "version": "9.3.5", + "name": "mockery/mockery", + "version": "1.6.7", "source": { "type": "git", - "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + "url": "https://github.com/mockery/mockery.git", + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", "shasum": "" }, "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": ">=7.3" }, "conflict": { - "squizlabs/php_codesniffer": "2.6.2" + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^8.5 || ^9.6.10", + "symplify/easy-coding-standard": "^12.0.8" }, - "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", + "autoload": { + "files": [ + "library/helpers.php", + "library/Mockery.php" + ], + "psr-4": { + "Mockery\\": "library/Mockery" + } }, - "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" + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "https://github.com/padraic", + "role": "Author" }, { - "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl", - "role": "lead" + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" }, { - "name": "Contributors", - "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], - "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", - "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", "keywords": [ - "compatibility", - "phpcs", - "standards" + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" ], "support": { - "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", - "source": "https://github.com/PHPCompatibility/PHPCompatibility" + "docs": "https://docs.mockery.io/", + "issues": "https://github.com/mockery/mockery/issues", + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories", + "source": "https://github.com/mockery/mockery" }, - "time": "2019-12-27T09:44:58+00:00" + "time": "2023-12-10T02:24:34+00:00" }, { - "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.2", + "name": "myclabs/deep-copy", + "version": "1.11.1", "source": { "type": "git", - "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { - "phpcompatibility/php-compatibility": "^9.0" + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", - "paragonie/random_compat": "dev-master", - "paragonie/sodium_compat": "dev-master" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, - "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", - "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, - "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL-3.0-or-later" + "MIT" ], - "authors": [ + "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": [ { - "name": "Wim Godden", - "role": "lead" - }, + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.17.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { - "name": "Juliette Reinders Folmer", - "role": "lead" + "name": "Nikita Popov" } ], - "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", - "homepage": "http://phpcompatibility.com/", + "description": "A PHP parser written in PHP", "keywords": [ - "compatibility", - "paragonie", - "phpcs", - "polyfill", - "standards", - "static analysis" + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + }, + "time": "2023-08-13T19:53:39+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "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": "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/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.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/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "php-parallel-lint/php-parallel-lint", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", + "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6483c9832e71973ed29cf71bd6b3f4fde438a9de", + "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.3.0" + }, + "replace": { + "grogy/php-parallel-lint": "*", + "jakub-onderka/php-parallel-lint": "*" + }, + "require-dev": { + "nette/tester": "^1.3 || ^2.0", + "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", + "squizlabs/php_codesniffer": "^3.6" + }, + "suggest": { + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool check syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "support": { + "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", + "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.3.2" + }, + "time": "2022-02-21T12:50:22+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", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer '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", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "time": "2022-10-25T01:46:02+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer '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", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "time": "2022-10-24T09:00:36+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "98bcdbacbda14b1db85f710b1853125726795bbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/98bcdbacbda14b1db85f710b1853125726795bbc", + "reference": "98bcdbacbda14b1db85f710b1853125726795bbc", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "time": "2023-08-26T04:46:45+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/69465cab9d12454e5e7767b9041af0cd8cd13be7", + "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.7.1 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "time": "2023-07-16T21:39:41+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.29", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-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", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-09-19T04:57:46+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "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/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "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", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "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/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-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/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.6.15", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.28", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.6-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "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", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2023-12-01T16:55:19+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-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 for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-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": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "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/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-05-07T05:35:17+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-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/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bde739e7565280bda77be70044ac1047bc007e34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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/5.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-02T09:26:13+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-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 for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-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/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "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/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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": "Adam Harvey", + "email": "aharvey@php.net" + } ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { - "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", - "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, - "time": "2022-10-25T01:46:02+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" }, { - "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.4", + "name": "sebastian/resource-operations", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "phpcompatibility/php-compatibility": "^9.0", - "phpcompatibility/phpcompatibility-paragonie": "^1.0" + "php": ">=7.3" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "phpunit/phpunit": "^9.0" }, - "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", - "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] }, - "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL-3.0-or-later" + "BSD-3-Clause" ], "authors": [ { - "name": "Wim Godden", - "role": "lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "lead" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", - "homepage": "http://phpcompatibility.com/", - "keywords": [ - "compatibility", - "phpcs", - "standards", - "static analysis", - "wordpress" - ], + "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/PHPCompatibility/PHPCompatibilityWP/issues", - "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" }, - "time": "2022-10-24T09:00:36+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "phpcsstandards/phpcsextra", - "version": "1.1.1", + "name": "sebastian/type", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "98bcdbacbda14b1db85f710b1853125726795bbc" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/98bcdbacbda14b1db85f710b1853125726795bbc", - "reference": "98bcdbacbda14b1db85f710b1853125726795bbc", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { - "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.0.8", - "squizlabs/php_codesniffer": "^3.7.1" + "php": ">=7.3" }, "require-dev": { - "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", - "phpcsstandards/phpcsdevcs": "^1.1.6", - "phpcsstandards/phpcsdevtools": "^1.2.1", - "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^9.5" }, - "type": "phpcodesniffer-standard", + "type": "library", "extra": { "branch-alias": { - "dev-stable": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-master": "3.2-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL-3.0-or-later" + "BSD-3-Clause" ], "authors": [ { - "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl", + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", "role": "lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" } ], - "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", - "keywords": [ - "PHP_CodeSniffer", - "phpcbf", - "phpcodesniffer-standard", - "phpcs", - "standards", - "static analysis" - ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", "support": { - "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", - "source": "https://github.com/PHPCSStandards/PHPCSExtra" + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, - "time": "2023-08-26T04:46:45+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" }, { - "name": "phpcsstandards/phpcsutils", - "version": "1.0.8", + "name": "sebastian/version", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/69465cab9d12454e5e7767b9041af0cd8cd13be7", - "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", - "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.7.1 || 4.0.x-dev@dev" - }, - "require-dev": { - "ext-filter": "*", - "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", - "phpcsstandards/phpcsdevcs": "^1.1.6", - "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + "php": ">=7.3" }, - "type": "phpcodesniffer-standard", + "type": "library", "extra": { "branch-alias": { - "dev-stable": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ - "PHPCSUtils/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL-3.0-or-later" + "BSD-3-Clause" ], "authors": [ { - "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl", + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", "role": "lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" } ], - "description": "A suite of utility functions for use with PHP_CodeSniffer", - "homepage": "https://phpcsutils.com/", - "keywords": [ - "PHP_CodeSniffer", - "phpcbf", - "phpcodesniffer-standard", - "phpcs", - "phpcs3", - "standards", - "static analysis", - "tokens", - "utility" - ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", "support": { - "docs": "https://phpcsutils.com/", - "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", - "source": "https://github.com/PHPCSStandards/PHPCSUtils" + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, - "time": "2023-07-16T21:39:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -509,6 +2443,56 @@ }, "time": "2023-02-22T23:07:41+00:00" }, + { + "name": "theseer/tokenizer", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.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/1.2.2" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2023-11-20T00:12:19+00:00" + }, { "name": "wp-coding-standards/wpcs", "version": "3.0.1", @@ -574,6 +2558,135 @@ } ], "time": "2023-09-14T07:06:09+00:00" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "224e4a1329c03d8bad520e3fc4ec980034a4b212" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/224e4a1329c03d8bad520e3fc4ec980034a4b212", + "reference": "224e4a1329c03d8bad520e3fc4ec980034a4b212", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "yoast/yoastcs": "^2.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "files": [ + "phpunitpolyfills-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" + } + ], + "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", + "keywords": [ + "phpunit", + "polyfill", + "testing" + ], + "support": { + "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "source": "https://github.com/Yoast/PHPUnit-Polyfills" + }, + "time": "2023-08-19T14:25:08+00:00" + }, + { + "name": "yoast/wp-test-utils", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/Yoast/wp-test-utils.git", + "reference": "2e0f62e0281e4859707c5f13b7da1422aa1c8f7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/wp-test-utils/zipball/2e0f62e0281e4859707c5f13b7da1422aa1c8f7b", + "reference": "2e0f62e0281e4859707c5f13b7da1422aa1c8f7b", + "shasum": "" + }, + "require": { + "brain/monkey": "^2.6.1", + "php": ">=5.6", + "yoast/phpunit-polyfills": "^1.1.0" + }, + "require-dev": { + "yoast/yoastcs": "^2.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "1.x-dev", + "dev-main": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "exclude-from-classmap": [ + "/src/WPIntegration/TestCase.php", + "/src/WPIntegration/TestCaseNoPolyfills.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/wp-test-utils/graphs/contributors" + } + ], + "description": "PHPUnit cross-version compatibility layer for testing plugins and themes build for WordPress", + "homepage": "https://github.com/Yoast/wp-test-utils/", + "keywords": [ + "brainmonkey", + "integration-testing", + "phpunit", + "testing", + "unit-testing", + "wordpress" + ], + "support": { + "issues": "https://github.com/Yoast/wp-test-utils/issues", + "source": "https://github.com/Yoast/wp-test-utils" + }, + "time": "2023-09-27T10:25:08+00:00" } ], "aliases": [], diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..e8e8560 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,15 @@ + + + + + ./tests/ + + + diff --git a/tests/bin/install-wp-tests.sh b/tests/bin/install-wp-tests.sh new file mode 100755 index 0000000..c941f8e --- /dev/null +++ b/tests/bin/install-wp-tests.sh @@ -0,0 +1,181 @@ +#!/usr/bin/env bash + +if [ $# -lt 3 ]; then + echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + exit 1 +fi + +DB_NAME=$1 +DB_USER=$2 +DB_PASS=$3 +DB_HOST=${4-localhost} +WP_VERSION=${5-latest} +SKIP_DB_CREATE=${6-false} + +TMPDIR=${TMPDIR-/tmp} +TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} +WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then + WP_BRANCH=${WP_VERSION%\-*} + WP_TESTS_TAG="branches/$WP_BRANCH" + +elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then + WP_TESTS_TAG="branches/$WP_VERSION" +elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + WP_TESTS_TAG="tags/${WP_VERSION%??}" + else + WP_TESTS_TAG="tags/$WP_VERSION" + fi +elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + WP_TESTS_TAG="trunk" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi +set -ex + +install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + + mkdir -p $WP_CORE_DIR + + if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + mkdir -p $TMPDIR/wordpress-trunk + rm -rf $TMPDIR/wordpress-trunk/* + svn export https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress + mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR + else + if [ $WP_VERSION == 'latest' ]; then + local ARCHIVE_NAME='latest' + elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then + # https serves multiple offers, whereas http serves single. + download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + LATEST_VERSION=${WP_VERSION%??} + else + # otherwise, scan the releases and get the most up to date minor version of the major release + local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` + LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) + fi + if [[ -z "$LATEST_VERSION" ]]; then + local ARCHIVE_NAME="wordpress-$WP_VERSION" + else + local ARCHIVE_NAME="wordpress-$LATEST_VERSION" + fi + else + local ARCHIVE_NAME="wordpress-$WP_VERSION" + fi + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz + tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR + fi + + download https://raw.githubusercontent.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php +} + +install_test_suite() { + # portable in-place argument for both GNU sed and Mac OSX sed + if [[ $(uname -s) == 'Darwin' ]]; then + local ioption='-i.bak' + else + local ioption='-i' + fi + + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + rm -rf $WP_TESTS_DIR/{includes,data} + svn export --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + svn export --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data + fi + + if [ ! -f wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + # remove all forward slashes in the end + WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") + sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s:__DIR__ . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi + +} + +recreate_db() { + shopt -s nocasematch + if [[ $1 =~ ^(y|yes)$ ]] + then + mysqladmin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA + create_db + echo "Recreated the database ($DB_NAME)." + else + echo "Leaving the existing database ($DB_NAME) in place." + fi + shopt -u nocasematch +} + +create_db() { + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA +} + +install_db() { + + if [ ${SKIP_DB_CREATE} = "true" ]; then + return 0 + fi + + # parse DB_HOST for port or socket references + local PARTS=(${DB_HOST//\:/ }) + local DB_HOSTNAME=${PARTS[0]}; + local DB_SOCK_OR_PORT=${PARTS[1]}; + local EXTRA="" + + if ! [ -z $DB_HOSTNAME ] ; then + if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then + EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" + elif ! [ -z $DB_SOCK_OR_PORT ] ; then + EXTRA=" --socket=$DB_SOCK_OR_PORT" + elif ! [ -z $DB_HOSTNAME ] ; then + EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" + fi + fi + + # create database + if [ $(mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ] + then + echo "Reinstalling will delete the existing test database ($DB_NAME)" + read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB + recreate_db $DELETE_EXISTING_DB + else + create_db + fi +} + +install_wp +install_test_suite +install_db diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..80f0d40 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,38 @@ +assertSame( 10, has_action( 'admin_init', [ self::$class_instance, 'register_settings' ] ) ); + $this->assertSame( 10, has_action( 'manage_edit-post_tag_columns', [ self::$class_instance, 'add_tag_columns' ] ) ); + $this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 ); + $this->assertSame( 10, has_action( 'tag_row_actions', [ self::$class_instance, 'remove_view_action' ] ), 10, 2 ); + } +} From 5cf5eb74dc00a47d69de487e4888861b49329ef6 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:11:49 +0100 Subject: [PATCH 02/16] Fix bootstrap --- tests/bootstrap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 80f0d40..8b12cc9 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,7 +2,7 @@ /** * PHPUnit bootstrap file. * - * @package Accessibility_Checker + * @package FewerTags */ $_tests_dir = getenv( 'WP_TESTS_DIR' ); @@ -29,7 +29,7 @@ * Manually load the plugin being tested. */ function _manually_load_plugin() { - require dirname( __DIR__ ) . '/accessibility-checker.php'; + require dirname( __DIR__ ) . '/fewer-tags.php'; } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); From 204fcc7b9787c43122de0bc308c83954f65f8fbb Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:15:50 +0100 Subject: [PATCH 03/16] Fix test --- tests/phpunit/helper-functions/test-class-admin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php index 7b0ccbd..7c412f0 100644 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ b/tests/phpunit/helper-functions/test-class-admin.php @@ -28,9 +28,11 @@ public static function set_up_before_class() { /** * Tests class constructor. * - * @covers Clicky_Admin::__construct + * @covers Admin::register_hooks */ - public function test___construct() { + public function test_register_hooks() { + self::$class_instance->register_hooks(); + $this->assertSame( 10, has_action( 'admin_init', [ self::$class_instance, 'register_settings' ] ) ); $this->assertSame( 10, has_action( 'manage_edit-post_tag_columns', [ self::$class_instance, 'add_tag_columns' ] ) ); $this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 ); From 57d23c6134139430857edc8f1386a7843cda8881 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:22:32 +0100 Subject: [PATCH 04/16] Fix test, second try --- tests/phpunit/helper-functions/test-class-admin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php index 7c412f0..c61e9e2 100644 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ b/tests/phpunit/helper-functions/test-class-admin.php @@ -5,6 +5,8 @@ * @package FewerTags */ +namespace FewerTags\Tests; + /** * Sample test case. */ @@ -22,7 +24,7 @@ class Admin extends WP_UnitTestCase { */ public static function set_up_before_class() { parent::set_up_before_class(); - self::$class_instance = new Admin(); + self::$class_instance = new FewerTags\Admin(); } /** From 1a82b42d001d14d03b7b18e92f71fe995bd300a9 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:25:24 +0100 Subject: [PATCH 05/16] Namespace fix --- tests/phpunit/helper-functions/test-class-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php index c61e9e2..7269f48 100644 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ b/tests/phpunit/helper-functions/test-class-admin.php @@ -10,7 +10,7 @@ /** * Sample test case. */ -class Admin extends WP_UnitTestCase { +class Admin extends \WP_UnitTestCase { /** * Instance of the class being tested. From f61033892a24badb35f5ec6aae5068c6a3956ef7 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:30:57 +0100 Subject: [PATCH 06/16] Namespace fix, 2nd try --- tests/phpunit/helper-functions/test-class-admin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php index 7269f48..4a69711 100644 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ b/tests/phpunit/helper-functions/test-class-admin.php @@ -5,6 +5,8 @@ * @package FewerTags */ +use FewerTags\Admin; + namespace FewerTags\Tests; /** @@ -15,7 +17,7 @@ class Admin extends \WP_UnitTestCase { /** * Instance of the class being tested. * - * @var Admin + * @var FewerTags\Admin */ private static $class_instance; @@ -24,7 +26,7 @@ class Admin extends \WP_UnitTestCase { */ public static function set_up_before_class() { parent::set_up_before_class(); - self::$class_instance = new FewerTags\Admin(); + self::$class_instance = new Admin(); } /** From 17cce4a44ecdb68b18877095d53e33fc1481d6c6 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:33:26 +0100 Subject: [PATCH 07/16] Namespace fix, 3rd try --- tests/phpunit/helper-functions/test-class-admin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php index 4a69711..a750243 100644 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ b/tests/phpunit/helper-functions/test-class-admin.php @@ -5,14 +5,14 @@ * @package FewerTags */ -use FewerTags\Admin; - namespace FewerTags\Tests; +use FewerTags\Admin; + /** * Sample test case. */ -class Admin extends \WP_UnitTestCase { +class Admin_Test extends \WP_UnitTestCase { /** * Instance of the class being tested. From 3f9fd27144cb2c8a838b1051280b307c0cef3409 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Sun, 10 Dec 2023 21:42:55 +0100 Subject: [PATCH 08/16] Add tests --- .../helper-functions/test-class-admin.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php index a750243..78ad16a 100644 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ b/tests/phpunit/helper-functions/test-class-admin.php @@ -30,7 +30,7 @@ public static function set_up_before_class() { } /** - * Tests class constructor. + * Tests hooks registration. * * @covers Admin::register_hooks */ @@ -42,4 +42,31 @@ public function test_register_hooks() { $this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 ); $this->assertSame( 10, has_action( 'tag_row_actions', [ self::$class_instance, 'remove_view_action' ] ), 10, 2 ); } + + /** + * Tests settings registration. + * + * @covers Admin::register_settings + */ + public function test_register_settings() { + self::$class_instance->register_settings(); + + global $wp_settings_sections, $wp_settings_fields; + + $this->assertArrayHasKey( 'fewer_tags_section', $wp_settings_sections ); + $this->assertArrayHasKey( 'joost_min_posts_count', $wp_settings_fields ); + } + + /** + * Tests display section. + * + * @covers Admin::display_section + */ + public function test_display_section() { + ob_start(); + self::$class_instance->display_section(); + $output = ob_get_clean(); + + $this->assertSame( 'Set the minimum number of posts a tag should have to become live on the site and not be redirected to the homepage.', $output ); + } } From 68867b607bd561a7d6e1b1b9aad7a5e2ca459272 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Tue, 12 Dec 2023 15:20:34 +0100 Subject: [PATCH 09/16] Add more tests --- .gitignore | 2 + .phpcs.xml.dist | 6 + phpunit.xml.dist | 5 + .../helper-functions/test-class-admin.php | 72 -------- tests/phpunit/test-class-admin.php | 174 ++++++++++++++++++ tests/phpunit/test-class-frontend.php | 78 ++++++++ 6 files changed, 265 insertions(+), 72 deletions(-) delete mode 100644 tests/phpunit/helper-functions/test-class-admin.php create mode 100644 tests/phpunit/test-class-admin.php create mode 100644 tests/phpunit/test-class-frontend.php diff --git a/.gitignore b/.gitignore index 57872d0..c519f08 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /vendor/ +/coverage/ +.phpunit.result.cache diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 9d188e3..6a2d45d 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -18,6 +18,12 @@ /node_modules/* + + /coverage/* + + + /tests/bootstrap.php + *.min.js diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e8e8560..88d8f95 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,4 +12,9 @@ ./tests/ + + + src + + diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php deleted file mode 100644 index 78ad16a..0000000 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ /dev/null @@ -1,72 +0,0 @@ -register_hooks(); - - $this->assertSame( 10, has_action( 'admin_init', [ self::$class_instance, 'register_settings' ] ) ); - $this->assertSame( 10, has_action( 'manage_edit-post_tag_columns', [ self::$class_instance, 'add_tag_columns' ] ) ); - $this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 ); - $this->assertSame( 10, has_action( 'tag_row_actions', [ self::$class_instance, 'remove_view_action' ] ), 10, 2 ); - } - - /** - * Tests settings registration. - * - * @covers Admin::register_settings - */ - public function test_register_settings() { - self::$class_instance->register_settings(); - - global $wp_settings_sections, $wp_settings_fields; - - $this->assertArrayHasKey( 'fewer_tags_section', $wp_settings_sections ); - $this->assertArrayHasKey( 'joost_min_posts_count', $wp_settings_fields ); - } - - /** - * Tests display section. - * - * @covers Admin::display_section - */ - public function test_display_section() { - ob_start(); - self::$class_instance->display_section(); - $output = ob_get_clean(); - - $this->assertSame( 'Set the minimum number of posts a tag should have to become live on the site and not be redirected to the homepage.', $output ); - } -} diff --git a/tests/phpunit/test-class-admin.php b/tests/phpunit/test-class-admin.php new file mode 100644 index 0000000..6366cdc --- /dev/null +++ b/tests/phpunit/test-class-admin.php @@ -0,0 +1,174 @@ + 'Post ' . $i, + 'post_status' => 'publish', + 'tags_input' => 'Live tag', + ] + ); + ++$i; + } + } + + /** + * Tests hooks registration. + * + * @covers FewerTags\Admin::register_hooks + */ + public function test_register_hooks() { + self::$class_instance->register_hooks(); + + $this->assertSame( 10, has_action( 'admin_init', [ self::$class_instance, 'register_settings' ] ) ); + $this->assertSame( 10, has_action( 'manage_edit-post_tag_columns', [ self::$class_instance, 'add_tag_columns' ] ) ); + $this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 ); + $this->assertSame( 10, has_action( 'tag_row_actions', [ self::$class_instance, 'remove_view_action' ] ), 10, 2 ); + } + + /** + * Tests settings registration. + * + * @covers FewerTags\Admin::register_settings + */ + public function test_register_settings() { + self::$class_instance->register_settings(); + + global $wp_settings_sections, $wp_settings_fields; + + $this->assertArrayHasKey( 'fewer_tags_section', $wp_settings_sections['reading'] ); + $this->assertArrayHasKey( 'joost_min_posts_count', $wp_settings_fields['reading']['fewer_tags_section'] ); + } + + /** + * Tests display section. + * + * @covers FewerTags\Admin::display_section + */ + public function test_display_section() { + ob_start(); + self::$class_instance->display_section(); + $output = ob_get_clean(); + + $this->assertSame( 'Set the minimum number of posts a tag should have to become live on the site and not be redirected to the homepage.', $output ); + } + + /** + * Tests display setting. + * + * @covers FewerTags\Admin::display_setting + */ + public function test_display_setting() { + ob_start(); + self::$class_instance->display_setting(); + $output = ob_get_clean(); + + $this->assertStringContainsString( 'name="joost_min_posts_count"', $output ); + $this->assertStringContainsString( 'id="joost_min_posts_count"', $output ); + $this->assertStringContainsString( 'type="number"', $output ); + $this->assertStringContainsString( 'min="1"', $output ); + $this->assertStringContainsString( 'value="5"', $output ); // This is tied to the value of FewerTags::$min_posts_count. + $this->assertStringContainsString( 'class="small-text"', $output ); + $this->assertStringContainsString( 'posts before being live on the site.', $output ); + } + + /** + * Tests add tag columns. + * + * @covers FewerTags\Admin::add_tag_columns + */ + public function test_add_tag_columns() { + $columns = self::$class_instance->add_tag_columns( [] ); + + $this->assertArrayHasKey( 'active', $columns ); + $this->assertSame( 'Live on site', $columns['active'] ); + } + + /** + * Tests manage tag columns. + * + * @covers FewerTags\Admin::manage_tag_columns + */ + public function test_manage_tag_columns() { + $out = self::$class_instance->manage_tag_columns( '', 'active', self::$not_live_tag['term_id'] ); + $this->assertMatchesRegularExpression( '/Not live/', $out ); + + $out = self::$class_instance->manage_tag_columns( '', 'active', self::$live_tag['term_id'] ); + $this->assertSame( 'Live', $out ); + } + + /** + * Tests remove view action. + * + * @covers FewerTags\Admin::remove_view_action + */ + public function test_remove_view_action() { + $actions = self::$class_instance->remove_view_action( $this->get_term_row_actions(), get_term( self::$not_live_tag['term_id'] ) ); + $this->assertArrayNotHasKey( 'view', $actions ); + + $actions = self::$class_instance->remove_view_action( $this->get_term_row_actions(), get_term( self::$live_tag['term_id'] ) ); + $this->assertArrayHasKey( 'view', $actions ); + } + + /** + * Returns the term row actions. + * + * @return array + */ + private function get_term_row_actions() { + return [ + 'edit' => 'Edit', + 'delete' => 'Delete', + 'view' => 'View', + ]; + } +} diff --git a/tests/phpunit/test-class-frontend.php b/tests/phpunit/test-class-frontend.php new file mode 100644 index 0000000..4ad911d --- /dev/null +++ b/tests/phpunit/test-class-frontend.php @@ -0,0 +1,78 @@ + 'Post ' . $i, + 'post_status' => 'publish', + 'tags_input' => 'Live tag', + ] + ); + ++$i; + } + } + + /** + * Tests hooks registration. + * + * @covers FewerTags\Frontend::register_hooks + */ + public function test_register_hooks() { + self::$class_instance->register_hooks(); + + $this->assertSame( 10, has_action( 'template_redirect', [ self::$class_instance, 'redirect_tag_pages' ] ) ); + $this->assertSame( 10, has_filter( 'get_the_tags', [ self::$class_instance, 'filter_get_the_tags' ] ) ); + $this->assertSame( 10, has_filter( 'get_the_terms', [ self::$class_instance, 'filter_get_the_terms' ] ) ); + $this->assertSame( 10, has_filter( 'wpseo_exclude_from_sitemap_by_term_ids', [ self::$class_instance, 'exclude_tags_from_yoast_sitemap' ] ) ); + $this->assertSame( 10, has_filter( 'wp_sitemaps_taxonomies_query_args', [ self::$class_instance, 'exclude_tags_from_core_sitemap' ] ) ); + } +} From 295160d1cb6f99cff4f1cf579e21afc811fb2124 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Tue, 12 Dec 2023 15:28:08 +0100 Subject: [PATCH 10/16] Add ignore for bootstrap --- .phpcs.xml.dist | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 6a2d45d..c3ac9b9 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -21,9 +21,6 @@ /coverage/* - - /tests/bootstrap.php - *.min.js @@ -148,12 +145,12 @@ For more information on ruleset configuration optiones, check out the PHPCS wiki: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset --> - - /path/to/Tests/*Test\.php - fewer-tags.php fewer-tags-playground.php + + /tests/bootstrap\.php$ + From f349b9ce2010bdd287b99a9c6cc431ca5e9c0722 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Tue, 12 Dec 2023 16:09:17 +0100 Subject: [PATCH 11/16] Test redirect tags --- src/class-frontend.php | 24 ---- tests/phpunit/test-class-frontend.php | 158 ++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 24 deletions(-) diff --git a/src/class-frontend.php b/src/class-frontend.php index 1f38601..451477f 100644 --- a/src/class-frontend.php +++ b/src/class-frontend.php @@ -82,30 +82,6 @@ public function filter_get_the_tags( $tags ) { return $tags; } - /** - * Filters the list of terms (including tags) retrieved to exclude tags with fewer than the specified minimum number of posts. - * - * @param array $terms The list of terms retrieved. - * @param string[] $taxonomies The taxonomies for which terms were retrieved. - * - * @return array The filtered list of terms. - */ - public function filter_get_terms( $terms, $taxonomies ) { - if ( is_admin() ) { - return $terms; - } - - if ( in_array( 'post_tag', $taxonomies, true ) && is_array( $terms ) ) { - foreach ( $terms as $key => $term ) { - if ( is_object( $term ) && $term->count < \FewerTags::$min_posts_count ) { - unset( $terms[ $key ] ); - } - } - } - - return $terms; - } - /** * Excludes tags with fewer than the minimum number of posts from the core sitemap. * diff --git a/tests/phpunit/test-class-frontend.php b/tests/phpunit/test-class-frontend.php index 4ad911d..0b9123a 100644 --- a/tests/phpunit/test-class-frontend.php +++ b/tests/phpunit/test-class-frontend.php @@ -36,6 +36,13 @@ class Frontend_Test extends \WP_UnitTestCase { */ private static $not_live_tag; + /** + * Test post. + * + * @var int + */ + private static $test_post; + /** * Set up the class instance to be tested. */ @@ -59,6 +66,36 @@ public static function set_up_before_class() { ); ++$i; } + // add 1 post with both the live and the not live tag. + self::$test_post = wp_insert_post( + [ + 'post_title' => 'Post ' . $i, + 'post_status' => 'publish', + 'tags_input' => [ 'Live tag', 'Not alive' ], + ] + ); + } + + /** + * Set up the test. + */ + public function set_up() { + parent::set_up(); + add_filter( 'wp_redirect', [ $this, 'filter_wp_redirect' ], 10, 2 ); + } + + /** + * Add an exception to wp_redirect / wp_safe_redirect so we can test it. + */ + public function filter_wp_redirect( $location, $status ) { + throw new \Exception( json_encode( + [ + 'location' => $location, + 'status' => $status, + ] + ) + ); + return false; } /** @@ -75,4 +112,125 @@ public function test_register_hooks() { $this->assertSame( 10, has_filter( 'wpseo_exclude_from_sitemap_by_term_ids', [ self::$class_instance, 'exclude_tags_from_yoast_sitemap' ] ) ); $this->assertSame( 10, has_filter( 'wp_sitemaps_taxonomies_query_args', [ self::$class_instance, 'exclude_tags_from_core_sitemap' ] ) ); } + + /** + * Tests redirect_tag_pages(). + * + * @covers FewerTags\Frontend::redirect_tag_pages + */ + public function test_redirect_tag_pages() { + $this->go_to( get_tag_link( self::$not_live_tag['term_id'] ) ); + + // Set the global $wp_query object as a tag page with fewer posts than required. + $GLOBALS['wp_query']->is_tag = true; + $GLOBALS['wp_query']->queried_object = (object) ['count' => 1]; // Assuming \FewerTags::$min_posts_count > 1 + + try { + self::$class_instance->redirect_tag_pages(); + } catch ( \Exception $e ) { + $redirect = json_decode( $e->getMessage(), true ); + $this->assertSame( home_url(), $redirect['location'] ); + $this->assertSame( 301, $redirect['status'] ); + } + + $this->go_to( get_tag_link( self::$live_tag['term_id'] ) ); + + // Set the global $wp_query object as a tag page with fewer posts than required. + $GLOBALS['wp_query']->is_tag = true; + $GLOBALS['wp_query']->queried_object = (object) ['count' => 11]; // Assuming \FewerTags::$min_posts_count > 1 + + self::$class_instance->redirect_tag_pages(); + $this->assertFalse( (bool) did_action( 'wp_redirect' ) ); + } + + /** + * Tests filter_get_the_terms(). + * + * @covers FewerTags\Frontend::filter_get_the_terms + */ + public function test_filter_get_the_terms() { + $live_tag = get_term( self::$live_tag['term_id'], 'post_tag' ); + $not_live_tag = get_term( self::$not_live_tag['term_id'], 'post_tag' ); + + // Test when count is 5, and the post has both the live and the not live tag. + $terms = self::$class_instance->filter_get_the_terms( [ $live_tag, $not_live_tag ], self::$test_post, 'post_tag' ); + $this->assertSame( [ $live_tag ], $terms ); + + FewerTags::$min_posts_count = 1; + + // Test when count is 1, and the post has both the live and the not live tag (which has 1 post in it, so _is_ live now). + $terms = self::$class_instance->filter_get_the_terms( [ $live_tag, $not_live_tag ], self::$test_post, 'post_tag' ); + $this->assertSame( [ $live_tag, $not_live_tag ], $terms ); + + FewerTags::$min_posts_count = 5; + + // Test with a taxonomy other than post_tag. + $terms = self::$class_instance->filter_get_the_terms( [ $live_tag, $not_live_tag ], self::$test_post, 'category' ); + $this->assertSame( [ $live_tag, $not_live_tag ], $terms ); + } + + /** + * Tests filter_get_the_tags(). + * + * @covers FewerTags\Frontend::filter_get_the_tags + */ + public function test_filter_get_the_tags() { + $live_tag = get_term( self::$live_tag['term_id'], 'post_tag' ); + $not_live_tag = get_term( self::$not_live_tag['term_id'], 'post_tag' ); + + $tags = self::$class_instance->filter_get_the_tags( [ $live_tag, $not_live_tag ] ); + $this->assertSame( [ $live_tag ], $tags ); + + FewerTags::$min_posts_count = 1; + + $tags = self::$class_instance->filter_get_the_tags( [ $live_tag, $not_live_tag ] ); + $this->assertSame( [ $live_tag, $not_live_tag ], $tags ); + + FewerTags::$min_posts_count = 5; + } + + /** + * Tests exclude_tags_from_yoast_sitemap(). + * + * @covers FewerTags\Frontend::exclude_tags_from_yoast_sitemap + */ + public function test_exclude_tags_from_yoast_sitemap() { + $term_ids = self::$class_instance->exclude_tags_from_yoast_sitemap( [] ); + $this->assertSame( [ self::$not_live_tag['term_id'] ], $term_ids ); + + FewerTags::$min_posts_count = 1; + + $term_ids = self::$class_instance->exclude_tags_from_yoast_sitemap( [] ); + $this->assertSame( [], $term_ids ); + + FewerTags::$min_posts_count = 0; + + // Test when count = 0 we don't do anything with the input. + $term_ids = self::$class_instance->exclude_tags_from_yoast_sitemap( [ 'test' ] ); + $this->assertSame( [ 'test' ], $term_ids ); + + FewerTags::$min_posts_count = 5; + } + + /** + * Tests exclude_tags_from_core_sitemap(). + * + * @covers FewerTags\Frontend::exclude_tags_from_core_sitemap + * @covers FewerTags\Frontend::get_tag_ids_with_fewer_than_min_posts + */ + public function test_exclude_tags_from_core_sitemap() { + $terms = self::$class_instance->exclude_tags_from_core_sitemap( [], 'post_tag' ); + $this->assertSame( [ 'exclude' => [ self::$not_live_tag['term_id'] ] ], $terms ); + + FewerTags::$min_posts_count = 1; + + $terms = self::$class_instance->exclude_tags_from_core_sitemap( [], 'post_tag' ); + $this->assertSame( [ 'exclude' => [] ], $terms ); + + // Test with a taxonomy other than post_tag. + $terms = self::$class_instance->exclude_tags_from_core_sitemap( [], 'category' ); + $this->assertSame( [], $terms ); + + FewerTags::$min_posts_count = 5; + } } From 917ef52aebfdb87fc86fabadfd23b268c4047430 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Wed, 13 Dec 2023 16:45:09 +0100 Subject: [PATCH 12/16] Fix CS --- tests/phpunit/test-class-frontend.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/phpunit/test-class-frontend.php b/tests/phpunit/test-class-frontend.php index 0b9123a..d527145 100644 --- a/tests/phpunit/test-class-frontend.php +++ b/tests/phpunit/test-class-frontend.php @@ -86,16 +86,21 @@ public function set_up() { /** * Add an exception to wp_redirect / wp_safe_redirect so we can test it. + * + * @param string $location The redirect location. + * @param int $status The redirect status. + * + * @throws \Exception When redirects is being tried. */ public function filter_wp_redirect( $location, $status ) { - throw new \Exception( json_encode( + throw new \Exception( + wp_json_encode( [ 'location' => $location, 'status' => $status, ] ) ); - return false; } /** @@ -120,10 +125,12 @@ public function test_register_hooks() { */ public function test_redirect_tag_pages() { $this->go_to( get_tag_link( self::$not_live_tag['term_id'] ) ); - + // Set the global $wp_query object as a tag page with fewer posts than required. - $GLOBALS['wp_query']->is_tag = true; - $GLOBALS['wp_query']->queried_object = (object) ['count' => 1]; // Assuming \FewerTags::$min_posts_count > 1 + $GLOBALS['wp_query']->is_tag = true; + + // Assuming \FewerTags::$min_posts_count > 1. + $GLOBALS['wp_query']->queried_object = (object) [ 'count' => 1 ]; try { self::$class_instance->redirect_tag_pages(); @@ -134,10 +141,12 @@ public function test_redirect_tag_pages() { } $this->go_to( get_tag_link( self::$live_tag['term_id'] ) ); - + // Set the global $wp_query object as a tag page with fewer posts than required. - $GLOBALS['wp_query']->is_tag = true; - $GLOBALS['wp_query']->queried_object = (object) ['count' => 11]; // Assuming \FewerTags::$min_posts_count > 1 + $GLOBALS['wp_query']->is_tag = true; + + // Assuming \FewerTags::$min_posts_count > 1. + $GLOBALS['wp_query']->queried_object = (object) [ 'count' => 11 ]; self::$class_instance->redirect_tag_pages(); $this->assertFalse( (bool) did_action( 'wp_redirect' ) ); @@ -151,7 +160,7 @@ public function test_redirect_tag_pages() { public function test_filter_get_the_terms() { $live_tag = get_term( self::$live_tag['term_id'], 'post_tag' ); $not_live_tag = get_term( self::$not_live_tag['term_id'], 'post_tag' ); - + // Test when count is 5, and the post has both the live and the not live tag. $terms = self::$class_instance->filter_get_the_terms( [ $live_tag, $not_live_tag ], self::$test_post, 'post_tag' ); $this->assertSame( [ $live_tag ], $terms ); From f7c9d030585b59925634b1cc78eeb1c8265db654 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Wed, 13 Dec 2023 20:55:08 +0100 Subject: [PATCH 13/16] Remove wrong test class admin file --- .../helper-functions/test-class-admin.php | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 tests/phpunit/helper-functions/test-class-admin.php diff --git a/tests/phpunit/helper-functions/test-class-admin.php b/tests/phpunit/helper-functions/test-class-admin.php deleted file mode 100644 index 7b0ccbd..0000000 --- a/tests/phpunit/helper-functions/test-class-admin.php +++ /dev/null @@ -1,39 +0,0 @@ -assertSame( 10, has_action( 'admin_init', [ self::$class_instance, 'register_settings' ] ) ); - $this->assertSame( 10, has_action( 'manage_edit-post_tag_columns', [ self::$class_instance, 'add_tag_columns' ] ) ); - $this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 ); - $this->assertSame( 10, has_action( 'tag_row_actions', [ self::$class_instance, 'remove_view_action' ] ), 10, 2 ); - } -} From cc97fba09a789f4909e9d0effb90f0f88d0feb05 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Wed, 13 Dec 2023 21:45:54 +0100 Subject: [PATCH 14/16] Test main plugin file too --- .phpcs.xml.dist | 1 + fewer-tags.php | 9 ++-- phpunit.xml.dist | 1 + src/class-frontend.php | 2 + tests/phpunit/test-fewer-tags.php | 85 +++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 tests/phpunit/test-fewer-tags.php diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index c3ac9b9..ad172dd 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -109,6 +109,7 @@ + diff --git a/fewer-tags.php b/fewer-tags.php index 1b1442e..22abce4 100644 --- a/fewer-tags.php +++ b/fewer-tags.php @@ -35,9 +35,9 @@ class FewerTags { public static $min_posts_count; /** - * Constructor method + * Register plugin hooks. */ - public function __construct() { + public function register_hooks() { add_action( 'init', [ $this, 'init' ] ); } @@ -45,7 +45,7 @@ public function __construct() { * Initialize the plugin and register hooks. */ public function init() { - self::$min_posts_count = get_option( 'joost_min_posts_count', 10 ); + self::$min_posts_count = (int) get_option( 'joost_min_posts_count', 10 ); require __DIR__ . '/vendor/autoload.php'; @@ -60,4 +60,5 @@ public function init() { } // Instantiate the plugin class. -new FewerTags(); +$fewer_tags = new FewerTags(); +$fewer_tags->register_hooks(); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 93e9ffd..0bfa1fc 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -15,6 +15,7 @@ src + fewer-tags.php diff --git a/src/class-frontend.php b/src/class-frontend.php index 451477f..7fdb358 100644 --- a/src/class-frontend.php +++ b/src/class-frontend.php @@ -31,7 +31,9 @@ public function redirect_tag_pages() { $tag = get_queried_object(); if ( $tag && $tag->count < \FewerTags::$min_posts_count ) { wp_safe_redirect( home_url(), 301 ); + // @codeCoverageIgnoreStart exit; + // @codeCoverageIgnoreEnd } } } diff --git a/tests/phpunit/test-fewer-tags.php b/tests/phpunit/test-fewer-tags.php new file mode 100644 index 0000000..f02184a --- /dev/null +++ b/tests/phpunit/test-fewer-tags.php @@ -0,0 +1,85 @@ +register_hooks(); + + $this->assertSame( 10, has_action( 'init', [ self::$class_instance, 'init' ] ) ); + } + + /** + * Tests init method. + * + * @covers FewerTags::init + */ + public function test_init() { + self::$class_instance->init(); + + $this->assertSame( 10, self::$class_instance::$min_posts_count ); + } + + /** + * Tests init method. + * + * @covers FewerTags::init + */ + public function test_init_admin() { + // Destroy the existing instance. + self::$class_instance = null; + + // Make it an admin environment. + $user_id = $this->factory->user->create( [ 'role' => 'administrator' ] ); + $user = wp_set_current_user( $user_id ); + + set_current_screen( 'dashboard' ); + + self::$class_instance = new FewerTags(); + self::$class_instance->init(); + + global $wp_filter; + $test_function = ''; + foreach ( $wp_filter['manage_post_tag_custom_column'][10] as $key => $hooked_function ) { + if ( $hooked_function['function'][0] instanceof Admin ) { + $test_function = $hooked_function['function'][1]; + } + } + $this->assertSame( 'manage_tag_columns', $test_function ); + } +} From ab88c9e3f88382ab8583dc41e9a1ac56a2fa05ba Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Wed, 13 Dec 2023 21:50:47 +0100 Subject: [PATCH 15/16] Tag version 1.3.1 --- fewer-tags.php | 4 ++-- readme.txt | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fewer-tags.php b/fewer-tags.php index 22abce4..ecf5235 100644 --- a/fewer-tags.php +++ b/fewer-tags.php @@ -3,14 +3,14 @@ * Plugin that redirects tag pages to the home page if they contain fewer than a specified number of posts. * * @package FewerTags - * @version 1.3 + * @version 1.3.1 * * Plugin Name: Fewer Tags * Plugin URI: https://joost.blog/plugins/fewer-tags/ * Description: Redirects tag pages to the home page if they contain fewer than a specified number of posts, defaults to 10. Change under Settings > Reading. Results in fewer useFewer tags, which is good for SEO. * Requires at least: 6.2 * Requires PHP: 7.4 - * Version: 1.3 + * Version: 1.3.1 * Author: Joost de Valk * Author URI: https://joost.blog * License: GPL-3.0+ diff --git a/readme.txt b/readme.txt index fb08705..c88ed9d 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: tag, tags, seo Requires at least: 6.2 Tested up to: 6.4 Requires PHP: 7.4 -Stable tag: 1.3 +Stable tag: 1.3.1 License: GPL3+ License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -46,6 +46,10 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro == Changelog == += 1.3.1 = + +* Fix fatal error caused by not loading the autoload file. + = 1.3 = * Make sure the output of the Gutenberg terms block is filtered to when it's showing tags. From 3fd38a0694c17088c72230cee4e9f8578c659539 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Wed, 13 Dec 2023 21:51:44 +0100 Subject: [PATCH 16/16] Tag version 1.3.1 --- fewer-tags.php | 4 ++-- readme.txt | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fewer-tags.php b/fewer-tags.php index 22abce4..ecf5235 100644 --- a/fewer-tags.php +++ b/fewer-tags.php @@ -3,14 +3,14 @@ * Plugin that redirects tag pages to the home page if they contain fewer than a specified number of posts. * * @package FewerTags - * @version 1.3 + * @version 1.3.1 * * Plugin Name: Fewer Tags * Plugin URI: https://joost.blog/plugins/fewer-tags/ * Description: Redirects tag pages to the home page if they contain fewer than a specified number of posts, defaults to 10. Change under Settings > Reading. Results in fewer useFewer tags, which is good for SEO. * Requires at least: 6.2 * Requires PHP: 7.4 - * Version: 1.3 + * Version: 1.3.1 * Author: Joost de Valk * Author URI: https://joost.blog * License: GPL-3.0+ diff --git a/readme.txt b/readme.txt index fb08705..c88ed9d 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: tag, tags, seo Requires at least: 6.2 Tested up to: 6.4 Requires PHP: 7.4 -Stable tag: 1.3 +Stable tag: 1.3.1 License: GPL3+ License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -46,6 +46,10 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro == Changelog == += 1.3.1 = + +* Fix fatal error caused by not loading the autoload file. + = 1.3 = * Make sure the output of the Gutenberg terms block is filtered to when it's showing tags.