From 0e88966246ef99fd81064fe41f7a03336ed380c3 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Tue, 13 Sep 2022 11:34:51 -0700 Subject: [PATCH] Add code coverage report --- .gitignore | 2 + composer.json | 3 +- composer.lock | 403 +++--------------- phpunit.xml.dist | 8 + plugins/wporg-5ftf/includes/contributor.php | 14 + plugins/wporg-5ftf/tests/test-auth.php | 26 +- plugins/wporg-5ftf/tests/test-contributor.php | 20 +- plugins/wporg-5ftf/tests/test-stats.php | 2 +- 8 files changed, 111 insertions(+), 367 deletions(-) diff --git a/.gitignore b/.gitignore index 552747c..2440a9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *.css.map *.js.map +coverage + mu-plugins/vendor mu-plugins/0-sandbox.php node_modules diff --git a/composer.json b/composer.json index 5209057..77b85d9 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ ], "test" : "phpunit", "_comment" : "Input won't work when running this via `composer test:watch`. If you want to use PHPUnit Watcher's interactive options then you'll need to call it directly in your terminal. See https://github.com/composer/composer/issues/5856", - "test:watch" : "phpunit-watcher watch" + "test:watch" : "phpunit-watcher watch", + "test:coverage": "php -d xdebug.mode=coverage ./mu-plugins/vendor/bin/phpunit --coverage-html coverage" } } diff --git a/composer.lock b/composer.lock index b5069ff..a155414 100644 --- a/composer.lock +++ b/composer.lock @@ -534,16 +534,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -584,9 +584,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "phar-io/manifest", @@ -699,252 +699,25 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" - }, - "time": "2022-03-15T21:29:03+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -993,7 +766,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -1001,7 +774,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1246,16 +1019,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.21", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -1270,7 +1043,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -1285,12 +1057,9 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -1332,7 +1101,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { @@ -1344,7 +1113,7 @@ "type": "github" } ], - "time": "2022-06-19T12:14:25+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "psr/container", @@ -2411,16 +2180,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -2432,7 +2201,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2455,7 +2224,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -2463,7 +2232,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -2640,16 +2409,16 @@ }, { "name": "symfony/console", - "version": "v5.4.10", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000" + "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/4d671ab4ddac94ee439ea73649c69d9d200b5000", - "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000", + "url": "https://api.github.com/repos/symfony/console/zipball/c072aa8f724c3af64e2c7a96b796a4863d24dba1", + "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1", "shasum": "" }, "require": { @@ -2719,7 +2488,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.10" + "source": "https://github.com/symfony/console/tree/v5.4.12" }, "funding": [ { @@ -2735,7 +2504,7 @@ "type": "tidelift" } ], - "time": "2022-06-26T13:00:04+00:00" + "time": "2022-08-17T13:18:05+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2806,16 +2575,16 @@ }, { "name": "symfony/finder", - "version": "v5.4.8", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" + "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", - "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", + "url": "https://api.github.com/repos/symfony/finder/zipball/7872a66f57caffa2916a584db1aa7f12adc76f8c", + "reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c", "shasum": "" }, "require": { @@ -2849,7 +2618,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.8" + "source": "https://github.com/symfony/finder/tree/v5.4.11" }, "funding": [ { @@ -2865,7 +2634,7 @@ "type": "tidelift" } ], - "time": "2022-04-15T08:07:45+00:00" + "time": "2022-07-29T07:37:50+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3361,16 +3130,16 @@ }, { "name": "symfony/process", - "version": "v5.4.8", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3" + "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", - "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1", + "reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1", "shasum": "" }, "require": { @@ -3403,7 +3172,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.8" + "source": "https://github.com/symfony/process/tree/v5.4.11" }, "funding": [ { @@ -3419,7 +3188,7 @@ "type": "tidelift" } ], - "time": "2022-04-08T05:07:18+00:00" + "time": "2022-06-27T16:58:25+00:00" }, { "name": "symfony/service-contracts", @@ -3506,16 +3275,16 @@ }, { "name": "symfony/string", - "version": "v5.4.10", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097" + "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4432bc7df82a554b3e413a8570ce2fea90e94097", - "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097", + "url": "https://api.github.com/repos/symfony/string/zipball/2fc515e512d721bf31ea76bd02fe23ada4640058", + "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058", "shasum": "" }, "require": { @@ -3572,7 +3341,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.10" + "source": "https://github.com/symfony/string/tree/v5.4.12" }, "funding": [ { @@ -3588,20 +3357,20 @@ "type": "tidelift" } ], - "time": "2022-06-26T15:57:47+00:00" + "time": "2022-08-12T17:03:11+00:00" }, { "name": "symfony/yaml", - "version": "v5.4.10", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "04e42926429d9e8b39c174387ab990bf7817f7a2" + "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/04e42926429d9e8b39c174387ab990bf7817f7a2", - "reference": "04e42926429d9e8b39c174387ab990bf7817f7a2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c", + "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c", "shasum": "" }, "require": { @@ -3647,7 +3416,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.10" + "source": "https://github.com/symfony/yaml/tree/v5.4.12" }, "funding": [ { @@ -3663,7 +3432,7 @@ "type": "tidelift" } ], - "time": "2022-06-20T11:50:59+00:00" + "time": "2022-08-02T15:52:22+00:00" }, { "name": "theseer/tokenizer", @@ -3715,64 +3484,6 @@ ], "time": "2021-07-28T10:34:58+00:00" }, - { - "name": "webmozart/assert", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "php": "^7.2 || ^8.0" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" - }, - "time": "2022-06-03T18:03:27+00:00" - }, { "name": "wp-coding-standards/wpcs", "version": "2.3.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index bc3f08f..3bcec35 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,9 +6,11 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" > + + @@ -16,4 +18,10 @@ + + + + ./plugins/wporg-5ftf/includes + + diff --git a/plugins/wporg-5ftf/includes/contributor.php b/plugins/wporg-5ftf/includes/contributor.php index 7e8a3e3..ec0d3a1 100644 --- a/plugins/wporg-5ftf/includes/contributor.php +++ b/plugins/wporg-5ftf/includes/contributor.php @@ -24,6 +24,8 @@ add_shortcode( '5ftf_my_pledges', __NAMESPACE__ . '\render_my_pledges' ); /** * Register the post type(s). * + * @codeCoverageIgnore + * * @return void */ function register_custom_post_type() { @@ -85,6 +87,8 @@ function register_custom_post_type() { * wouldn't be scheduled. * * @see https://dotorg.trac.wordpress.org/changeset/15351/ + * + * @codeCoverageIgnore */ function schedule_cron_jobs() { if ( ! wp_next_scheduled( 'notify_inactive_contributors' ) ) { @@ -95,6 +99,8 @@ function schedule_cron_jobs() { /** * Add columns to the Contributors list table. * + * @codeCoverageIgnore + * * @param array $columns * * @return array @@ -113,6 +119,8 @@ function add_list_table_columns( $columns ) { /** * Render content in the custom columns added to the Contributors list table. * + * @codeCoverageIgnore + * * @param string $column * @param int $post_id * @@ -392,6 +400,8 @@ function get_contributor_user_ids( $contributor_posts ) { /** * Only show the My Pledges menu to users who are logged in. * + * @codeCoverageIgnore + * * @param array $menu_items * * @return array @@ -413,6 +423,8 @@ function hide_my_pledges_when_logged_out( $menu_items ) { /** * Render the My Pledges shortcode. * + * @codeCoverageIgnore + * * @return string */ function render_my_pledges() { @@ -586,6 +598,8 @@ function parse_contributors( $contributors, $pledge_id = null ) { /** * Send an email to inactive contributors. + * + * @codeCoverageIgnore */ function notify_inactive_contributors() : void { $contributors = get_inactive_contributor_batch(); diff --git a/plugins/wporg-5ftf/tests/test-auth.php b/plugins/wporg-5ftf/tests/test-auth.php index 069bf31..86280ed 100644 --- a/plugins/wporg-5ftf/tests/test-auth.php +++ b/plugins/wporg-5ftf/tests/test-auth.php @@ -80,7 +80,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_valid_token_accepted() { $verified = is_valid_authentication_token( self::$pledge->ID, self::$action, self::$token['value'] ); @@ -88,7 +88,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token * @dataProvider data_invalid_token_provider */ public function test_invalid_tokens_are_rejected( $token_to_validate ) { @@ -107,7 +107,7 @@ class Test_Auth extends WP_UnitTestCase { * Note that data providers can't access fixtures. * See https://phpunit.readthedocs.io/en/7.4/writing-tests-for-phpunit.html#data-providers. * - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function data_invalid_token_provider() { return array( @@ -119,7 +119,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_expired_tokens_are_rejected() { $expired_token = self::$token; @@ -137,7 +137,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_used_tokens_are_rejected() { // The token should be deleted once it's used/verified for the first time. @@ -149,7 +149,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_valid_tokens_are_rejected_for_other_actions() { // Generate new token on pledge. @@ -167,7 +167,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_valid_tokens_are_rejected_for_other_pledges() { $new_pledge_id = self::factory()->post->create( array( @@ -190,7 +190,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_reusable_token_is_reusable() { $action = 'manage_pledge'; @@ -207,7 +207,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::is_valid_authentication_token + * @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token */ public function test_expired_reusable_tokens_are_rejected() { $action = 'manage_pledge'; @@ -222,7 +222,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::can_manage_pledge + * @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge */ public function test_user_with_token_can_manage_pledge() { $action = 'manage_pledge'; @@ -233,7 +233,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::can_manage_pledge + * @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge */ public function test_user_without_token_cant_manage_pledge() { $result = can_manage_pledge( self::$pledge->ID, '' ); @@ -241,7 +241,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::can_manage_pledge + * @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge */ public function test_logged_in_admin_can_manage_pledge() { $user = self::factory()->user->create( @@ -256,7 +256,7 @@ class Test_Auth extends WP_UnitTestCase { } /** - * @covers ::can_manage_pledge + * @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge */ public function test_logged_in_subscriber_cant_manage_pledge() { $user = self::factory()->user->create( diff --git a/plugins/wporg-5ftf/tests/test-contributor.php b/plugins/wporg-5ftf/tests/test-contributor.php index 3488222..d7fb76f 100644 --- a/plugins/wporg-5ftf/tests/test-contributor.php +++ b/plugins/wporg-5ftf/tests/test-contributor.php @@ -49,8 +49,11 @@ class Test_Contributor extends WP_UnitTestCase { } /** - * @covers ::remove_pledge_contributors - * @covers ::remove_contributors + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_pledge_contributors + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_contributor + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\add_pledge_contributors + * @covers WordPressDotOrg\FiveForTheFuture\XProfile\get_contributor_user_data + * @covers WordPressDotOrg\FiveForTheFuture\Pledge\deactivate */ public function test_data_reset_once_no_active_sponsors() : void { // Setup scenario where Jane is sponsored by two companies. @@ -113,8 +116,11 @@ class Test_Contributor extends WP_UnitTestCase { } /** - * @covers ::remove_pledge_contributors - * @covers ::remove_contributors + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_pledge_contributors + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_contributor + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\add_pledge_contributors + * @covers WordPressDotOrg\FiveForTheFuture\XProfile\get_contributor_user_data + * @covers WordPressDotOrg\FiveForTheFuture\Pledge\deactivate */ public function test_data_not_reset_when_unconfirmed_sponsor() : void { // Setup scenario where Jane was invited to join a company but didn't respond. @@ -153,7 +159,9 @@ class Test_Contributor extends WP_UnitTestCase { } /** - * @covers ::remove_contributors + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_contributor + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\add_pledge_contributors + * @covers WordPressDotOrg\FiveForTheFuture\XProfile\get_contributor_user_data */ public function test_data_reset_when_single_contributor_removed_from_pledge() : void { // Setup scenario where Jane and Ashish are sponsored by a company. @@ -206,7 +214,7 @@ class Test_Contributor extends WP_UnitTestCase { } /** - * @covers ::prune_unnotifiable_users + * @covers WordPressDotOrg\FiveForTheFuture\Contributor\prune_unnotifiable_users */ public function test_prune_unnotifiable_users() { $contributors = array( diff --git a/plugins/wporg-5ftf/tests/test-stats.php b/plugins/wporg-5ftf/tests/test-stats.php index fc4286c..06d6d09 100644 --- a/plugins/wporg-5ftf/tests/test-stats.php +++ b/plugins/wporg-5ftf/tests/test-stats.php @@ -43,7 +43,7 @@ class Test_Stats extends WP_UnitTestCase { } /** - * @covers ::get_snapshot_data + * @covers WordPressDotOrg\FiveForTheFuture\Stats\get_snapshot_data */ public function test_get_snapshot() : void { // Setup 2 company-sponsored contributors.