From 83f49f3c50563f82d0f2796cf07ac66da3d492e8 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 4 Jun 2020 19:44:32 -0400 Subject: [PATCH 01/25] ACF connector test implemented. --- composer.json | 14 +- composer.lock | 612 +++++++++++++++--- connectors/class-connector-acf.php | 242 ++++++- phpcs.xml.dist | 6 +- phpunit.xml | 6 + tests/bootstrap.php | 25 + .../connectors/test-class-connector-acf.php | 295 +++++++++ 7 files changed, 1090 insertions(+), 110 deletions(-) create mode 100644 tests/tests/connectors/test-class-connector-acf.php diff --git a/composer.json b/composer.json index 0a51aa054..2288f29bc 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,12 @@ "homepage": "https://wordpress.org/plugins/stream/", "type": "wordpress-plugin", "license": "GPL-2.0-or-later", + "repositories": [ + { + "type":"composer", + "url":"https://wpackagist.org" + } + ], "require": { "composer/installers": "~1.0" }, @@ -15,7 +21,8 @@ "wp-cli/wp-cli-bundle": "^2.2", "wp-coding-standards/wpcs": "^2.2", "wp-phpunit/wp-phpunit": "^5.4", - "wpsh/local": "^0.2.3" + "wpsh/local": "^0.2.3", + "wpackagist-plugin/advanced-custom-fields": "5.8.12" }, "config": { "process-timeout": 600, @@ -25,7 +32,10 @@ } }, "extra": { - "wordpress-install-dir": "local/public" + "wordpress-install-dir": "local/public", + "installer-paths": { + "local/public/wp-content/plugins/{$name}/": ["type:wordpress-plugin"] + } }, "scripts": { "release": [ diff --git a/composer.lock b/composer.lock index 58d193226..23dea658e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "74043f691d06bd00f61066eec761aa80", + "content-hash": "028b548fadf428b765cbcfc049cc00b2", "packages": [ { "name": "composer/installers", @@ -137,30 +137,30 @@ "packages-dev": [ { "name": "automattic/vipwpcs", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "fc02f491dc9f51da7c32941ac579f70b9ed300c5" + "reference": "03e75ddd0261b675dece60fb67fc2e9c6af4ad35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/fc02f491dc9f51da7c32941ac579f70b9ed300c5", - "reference": "fc02f491dc9f51da7c32941ac579f70b9ed300c5", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/03e75ddd0261b675dece60fb67fc2e9c6af4ad35", + "reference": "03e75ddd0261b675dece60fb67fc2e9c6af4ad35", "shasum": "" }, "require": { - "php": ">=5.6", - "squizlabs/php_codesniffer": "^3.3.1", - "wp-coding-standards/wpcs": "^2.1" + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.5.5", + "wp-coding-standards/wpcs": "^2.3" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "phpcompatibility/php-compatibility": "^9", - "phpunit/phpunit": "^5 || ^6 || ^7" + "phpunit/phpunit": "^4 || ^5 || ^6 || ^7" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will manage the PHPCS 'installed_paths' automatically." }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -179,7 +179,7 @@ "standards", "wordpress" ], - "time": "2019-07-12T08:47:36+00:00" + "time": "2020-07-07T07:48:04+00:00" }, { "name": "composer/ca-bundle", @@ -239,16 +239,16 @@ }, { "name": "composer/composer", - "version": "1.10.8", + "version": "1.10.10", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "56e0e094478f30935e9128552188355fa9712291" + "reference": "32966a3b1d48bc01472a8321fd6472b44fad033a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/56e0e094478f30935e9128552188355fa9712291", - "reference": "56e0e094478f30935e9128552188355fa9712291", + "url": "https://api.github.com/repos/composer/composer/zipball/32966a3b1d48bc01472a8321fd6472b44fad033a", + "reference": "32966a3b1d48bc01472a8321fd6472b44fad033a", "shasum": "" }, "require": { @@ -315,7 +315,21 @@ "dependency", "package" ], - "time": "2020-06-24T19:23:30+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-03T09:35:19+00:00" }, { "name": "composer/semver", @@ -380,16 +394,16 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.3", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" + "reference": "6946f785871e2314c60b4524851f3702ea4f2223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/6946f785871e2314c60b4524851f3702ea4f2223", + "reference": "6946f785871e2314c60b4524851f3702ea4f2223", "shasum": "" }, "require": { @@ -436,7 +450,21 @@ "spdx", "validator" ], - "time": "2020-02-14T07:44:31+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-07-15T15:35:07+00:00" }, { "name": "composer/xdebug-handler", @@ -1265,6 +1293,55 @@ ], "time": "2013-02-24T15:01:54+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v2.0.18", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "time": "2019-01-03T20:59:08+00:00" + }, { "name": "php-coveralls/php-coveralls", "version": "v2.2.0", @@ -2698,16 +2775,16 @@ }, { "name": "seld/phar-utils", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", "shasum": "" }, "require": { @@ -2738,7 +2815,7 @@ "keywords": [ "phar" ], - "time": "2020-02-14T15:25:33+00:00" + "time": "2020-07-07T18:42:57+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2793,16 +2870,16 @@ }, { "name": "symfony/config", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "cd61db31cbd19cbe4ba9f6968f13c9076e1372ab" + "reference": "9e2aa97f0d51f114983666f5aa362426d53e004a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/cd61db31cbd19cbe4ba9f6968f13c9076e1372ab", - "reference": "cd61db31cbd19cbe4ba9f6968f13c9076e1372ab", + "url": "https://api.github.com/repos/symfony/config/zipball/9e2aa97f0d51f114983666f5aa362426d53e004a", + "reference": "9e2aa97f0d51f114983666f5aa362426d53e004a", "shasum": "" }, "require": { @@ -2853,20 +2930,34 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2020-05-22T10:56:48+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-23T09:37:51+00:00" }, { "name": "symfony/console", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "bfe29ead7e7b1cc9ce74c6a40d06ad1f96fced13" + "reference": "afc7189694d2c59546cf24ea606a236fa46a966e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/bfe29ead7e7b1cc9ce74c6a40d06ad1f96fced13", - "reference": "bfe29ead7e7b1cc9ce74c6a40d06ad1f96fced13", + "url": "https://api.github.com/repos/symfony/console/zipball/afc7189694d2c59546cf24ea606a236fa46a966e", + "reference": "afc7189694d2c59546cf24ea606a236fa46a966e", "shasum": "" }, "require": { @@ -2925,20 +3016,34 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-05-30T18:58:05+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-06T08:57:31+00:00" }, { "name": "symfony/debug", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "518c6a00d0872da30bd06aee3ea59a0a5cf54d6d" + "reference": "7ce874f4432d8b11cc45a80cc5130a6e2609728d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/518c6a00d0872da30bd06aee3ea59a0a5cf54d6d", - "reference": "518c6a00d0872da30bd06aee3ea59a0a5cf54d6d", + "url": "https://api.github.com/repos/symfony/debug/zipball/7ce874f4432d8b11cc45a80cc5130a6e2609728d", + "reference": "7ce874f4432d8b11cc45a80cc5130a6e2609728d", "shasum": "" }, "require": { @@ -2981,11 +3086,25 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2020-05-22T18:25:20+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-16T09:41:49+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -3031,11 +3150,25 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-05-30T17:48:24+00:00" }, { "name": "symfony/finder", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3080,20 +3213,34 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-02-14T07:34:21+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.1", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", "shasum": "" }, "require": { @@ -3105,7 +3252,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3142,25 +3289,40 @@ "polyfill", "portable" ], - "time": "2020-06-06T08:46:27+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.17.1", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a57f8161502549a742a63c09f0a604997bf47027" + "reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a57f8161502549a742a63c09f0a604997bf47027", - "reference": "a57f8161502549a742a63c09f0a604997bf47027", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/5dcab1bc7146cf8c1beaa4502a3d9be344334251", + "reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php70": "^1.10", "symfony/polyfill-php72": "^1.10" }, "suggest": { @@ -3169,7 +3331,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3193,6 +3355,10 @@ "name": "Laurent Bassin", "email": "laurent@bassin.info" }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" @@ -3208,20 +3374,115 @@ "portable", "shim" ], - "time": "2020-06-06T08:46:27+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-08-04T06:02:08+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", + "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.1", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7110338d81ce1cbc3e273136e4574663627037a7" + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7", - "reference": "7110338d81ce1cbc3e273136e4574663627037a7", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", "shasum": "" }, "require": { @@ -3233,7 +3494,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3271,20 +3532,111 @@ "portable", "shim" ], - "time": "2020-06-06T08:46:27+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3", + "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0|~9.99", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.17.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "f048e612a3905f34931127360bdd2def19a5e582" + "reference": "639447d008615574653fb3bc60d1986d7172eaae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", - "reference": "f048e612a3905f34931127360bdd2def19a5e582", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", + "reference": "639447d008615574653fb3bc60d1986d7172eaae", "shasum": "" }, "require": { @@ -3293,7 +3645,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3326,20 +3682,34 @@ "portable", "shim" ], - "time": "2020-05-12T16:47:27+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/process", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8a895f0c92a7c4b10db95139bcff71bdf66d4d21" + "reference": "af8d812d75fcdf2eae30928b42396fe17df137e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8a895f0c92a7c4b10db95139bcff71bdf66d4d21", - "reference": "8a895f0c92a7c4b10db95139bcff71bdf66d4d21", + "url": "https://api.github.com/repos/symfony/process/zipball/af8d812d75fcdf2eae30928b42396fe17df137e4", + "reference": "af8d812d75fcdf2eae30928b42396fe17df137e4", "shasum": "" }, "require": { @@ -3375,11 +3745,25 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2020-05-23T17:05:51+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-16T09:41:49+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -3424,20 +3808,34 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-03-15T09:38:08+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.42", + "version": "v3.4.43", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "7233ac2bfdde24d672f5305f2b3f6b5d741ef8eb" + "reference": "e7fa05917ae931332a42d65b577ece4d497aad81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/7233ac2bfdde24d672f5305f2b3f6b5d741ef8eb", - "reference": "7233ac2bfdde24d672f5305f2b3f6b5d741ef8eb", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e7fa05917ae931332a42d65b577ece4d497aad81", + "reference": "e7fa05917ae931332a42d65b577ece4d497aad81", "shasum": "" }, "require": { @@ -3483,24 +3881,38 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2020-05-11T07:51:54+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-23T09:37:51+00:00" }, { "name": "webmozart/assert", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -3532,7 +3944,7 @@ "check", "validate" ], - "time": "2020-06-16T10:16:42+00:00" + "time": "2020-07-08T17:02:28+00:00" }, { "name": "wp-cli/cache-command", @@ -4402,16 +4814,16 @@ }, { "name": "wp-cli/i18n-command", - "version": "v2.2.4", + "version": "v2.2.5", "source": { "type": "git", "url": "https://github.com/wp-cli/i18n-command.git", - "reference": "9784ff2c074d1765442b618e6d3a43fee2093a05" + "reference": "b02ecdc9a57f9633740c254d19749118b7411f0f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/9784ff2c074d1765442b618e6d3a43fee2093a05", - "reference": "9784ff2c074d1765442b618e6d3a43fee2093a05", + "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/b02ecdc9a57f9633740c254d19749118b7411f0f", + "reference": "b02ecdc9a57f9633740c254d19749118b7411f0f", "shasum": "" }, "require": { @@ -4455,7 +4867,7 @@ ], "description": "Provides internationalization tools for WordPress projects.", "homepage": "https://github.com/wp-cli/i18n-command", - "time": "2020-06-12T00:17:09+00:00" + "time": "2020-07-08T15:20:38+00:00" }, { "name": "wp-cli/import-command", @@ -5589,6 +6001,24 @@ ], "time": "2020-04-01T14:35:27+00:00" }, + { + "name": "wpackagist-plugin/advanced-custom-fields", + "version": "5.8.12", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/advanced-custom-fields/", + "reference": "tags/5.8.12" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/advanced-custom-fields.5.8.12.zip" + }, + "require": { + "composer/installers": "~1.0" + }, + "type": "wordpress-plugin", + "homepage": "https://wordpress.org/plugins/advanced-custom-fields/" + }, { "name": "wpsh/local", "version": "0.2.3", diff --git a/connectors/class-connector-acf.php b/connectors/class-connector-acf.php index 7a9f4302a..431d5d965 100644 --- a/connectors/class-connector-acf.php +++ b/connectors/class-connector-acf.php @@ -31,6 +31,8 @@ class Connector_ACF extends Connector { * @var array */ public $actions = array( + 'save_post', + 'post_updated', 'added_post_meta', 'updated_post_meta', 'delete_post_meta', @@ -147,13 +149,210 @@ public function action_links( $links, $record ) { return $links; } + /** + * Tracks the creation of custom field group fields and settings (ACF v5+ only) + * + * @action save_post + * + * @param int $post_id Post ID. + * @param WP_Post $post Post object. + * @param bool $update Whether this is an existing post being updated or not. + */ + public function callback_save_post( $post_id, $post, $update ) { + // Bail if updating existing post. + if ( false !== $update ) { + return; + } + + // Log new ACF field additions to field groups. + if ( 'acf-field' === $post->post_type ) { + $parent = get_post( $post->post_parent ); + if ( $parent ) { + $this->log_prop( 'added', $post_id, $post, 'parent', $parent ); + } + } elseif ( 'acf-field-group' === $post->post_type ) { + $props = maybe_unserialize( $post->post_content ); + + if ( ! empty( $props ) && is_array( $props ) ) { + foreach ( $props as $prop => $value ) { + $this->log_prop( 'added', $post_id, $post, $prop, $value ); + } + } + } + } + + /** + * Tracks changes to custom field groups settings. + * + * @action post_updated + * + * @param int $post_id Post ID. + * @param \WP_Post $posts_after Newly saved post object. + * @param \WP_Post $posts_before Old post object. + * @return void + */ + public function callback_post_updated( $post_id, $posts_after, $posts_before ) { + if ( 'acf-field-group' !== $posts_after->post_type ) { + return; + } + + $_new = ! empty( $posts_after->post_content ) ? maybe_unserialize( $posts_after->post_content ) : array(); + $_old = ! empty( $posts_before->post_content ) ? maybe_unserialize( $posts_before->post_content ) : array(); + + // Get updated settings. + $updated_keys = $this->get_changed_keys( $_new, $_old ); + $updated_keys = empty( $updated_keys ) ? array_keys( $_new ) : $updated_keys; + + // Process updated properties. + foreach ( $updated_keys as $prop ) { + $old_value = null; + $value = $_new[ $prop ]; + if ( empty( $value ) && is_array( $_old ) && ! empty( $_old[ $prop ] ) ) { + $action = 'deleted'; + $old_value = $_old[ $prop ]; + } else { + $action = 'updated'; + } + + $this->log_prop( $action, $post_id, $posts_after, $prop, $value, $old_value ); + } + } + + + /** + * Logs field/field group property changes (ACF v5 only). + * + * @param string $action Added, updated, deleted. + * @param int $post_id Post ID. + * @param WP_Post $post Post object. + * @param string $property ACF property. + * @param mixed|null $value Value assigned to property. + * @param mixed|null $old_value Old value previously assigned to property. + * @return void + */ + public function log_prop( $action, $post_id, $post, $property, $value = null, $old_value = null ) { + $action_labels = $this->get_action_labels(); + + // Fields. + if ( 'parent' === $property ) { + if ( 'deleted' === $action ) { + $meta_value = $old_value; + } + + $this->log( + /* translators: %1$s: field label, %2$s: form title, %3$s: action (e.g. "Message", "Contact", "Created") */ + esc_html_x( '"%1$s" field in "%2$s" %3$s', 'acf', 'stream' ), + array( + 'label' => $post->post_title, + 'title' => $value->post_title, + 'action' => strtolower( $action_labels[ $action ] ), + 'key' => $post->post_name, + 'name' => $post->post_excerpt, + ), + $value->ID, + 'fields', + $action + ); + } elseif ( 'position' === $property ) { + if ( 'deleted' === $action ) { + return; + } + + $options = array( + 'acf_after_title' => esc_html_x( 'High (after title)', 'acf', 'stream' ), + 'normal' => esc_html_x( 'Normal (after content)', 'acf', 'stream' ), + 'side' => esc_html_x( 'Side', 'acf', 'stream' ), + ); + + $this->log( + /* translators: %1$s: form title, %2$s a position (e.g. "Contact", "Side") */ + esc_html_x( 'Position of "%1$s" updated to "%2$s"', 'acf', 'stream' ), + array( + 'title' => $post->post_title, + 'option_label' => $options[ $value ], + 'option' => $property, + 'option_value' => $value, + ), + $post_id, + 'options', + 'updated' + ); + } elseif ( 'layout' === $property ) { + if ( 'deleted' === $action ) { + return; + } + + $options = array( + 'no_box' => esc_html_x( 'Seamless (no metabox)', 'acf', 'stream' ), + 'default' => esc_html_x( 'Standard (WP metabox)', 'acf', 'stream' ), + ); + + $this->log( + /* translators: %1$s: form title, %2$s a layout (e.g. "Contact", "Seamless") */ + esc_html_x( 'Style of "%1$s" updated to "%2$s"', 'acf', 'stream' ), + array( + 'title' => $post->post_title, + 'option_label' => $options[ $value ], + 'option' => $property, + 'option_value' => $value, + ), + $post_id, + 'options', + 'updated' + ); + } elseif ( 'hide_on_screen' === $property ) { + if ( 'deleted' === $action ) { + return; + } + + $options = array( + 'permalink' => esc_html_x( 'Permalink', 'acf', 'stream' ), + 'the_content' => esc_html_x( 'Content Editor', 'acf', 'stream' ), + 'excerpt' => esc_html_x( 'Excerpt', 'acf', 'stream' ), + 'custom_fields' => esc_html_x( 'Custom Fields', 'acf', 'stream' ), + 'discussion' => esc_html_x( 'Discussion', 'acf', 'stream' ), + 'comments' => esc_html_x( 'Comments', 'acf', 'stream' ), + 'revisions' => esc_html_x( 'Revisions', 'acf', 'stream' ), + 'slug' => esc_html_x( 'Slug', 'acf', 'stream' ), + 'author' => esc_html_x( 'Author', 'acf', 'stream' ), + 'format' => esc_html_x( 'Format', 'acf', 'stream' ), + 'featured_image' => esc_html_x( 'Featured Image', 'acf', 'stream' ), + 'categories' => esc_html_x( 'Categories', 'acf', 'stream' ), + 'tags' => esc_html_x( 'Tags', 'acf', 'stream' ), + 'send-trackbacks' => esc_html_x( 'Send Trackbacks', 'acf', 'stream' ), + ); + + if ( is_array( $value ) && count( $options ) === count( $value ) ) { + $options_label = esc_html_x( 'All screens', 'acf', 'stream' ); + } elseif ( empty( $value ) ) { + $options_label = esc_html_x( 'No screens', 'acf', 'stream' ); + } else { + $options_label = implode( ', ', array_intersect_key( $options, array_flip( $value ) ) ); + } + + $this->log( + /* translators: %1$s: a form title, %2$s: a display option (e.g. "Contact", "All screens") */ + esc_html_x( '"%1$s" set to display on "%2$s"', 'acf', 'stream' ), + array( + 'title' => $post->post_title, + 'option_label' => $options_label, + 'option' => $property, + 'option_value' => $value, + ), + $post_id, + 'options', + 'updated' + ); + } + } + /** * Track addition of post meta * * @action added_post_meta */ public function callback_added_post_meta() { - call_user_func_array( array( $this, 'check_meta' ), array_merge( array( 'post', 'added' ), func_get_args() ) ); + $this->check_meta( 'post', 'added', ...func_get_args() ); } /** @@ -162,7 +361,7 @@ public function callback_added_post_meta() { * @action updated_post_meta */ public function callback_updated_post_meta() { - call_user_func_array( array( $this, 'check_meta' ), array_merge( array( 'post', 'updated' ), func_get_args() ) ); + $this->check_meta( 'post', 'updated', ...func_get_args() ); } /** @@ -174,7 +373,7 @@ public function callback_updated_post_meta() { * @action delete_post_meta */ public function callback_delete_post_meta() { - call_user_func_array( array( $this, 'check_meta' ), array_merge( array( 'post', 'deleted' ), func_get_args() ) ); + $this->check_meta( 'post', 'deleted', ...func_get_args() ); } /** @@ -183,7 +382,7 @@ public function callback_delete_post_meta() { * @action added_user_meta */ public function callback_added_user_meta() { - call_user_func_array( array( $this, 'check_meta' ), array_merge( array( 'user', 'added' ), func_get_args() ) ); + $this->check_meta( 'user', 'added', ...func_get_args() ); } /** @@ -192,7 +391,7 @@ public function callback_added_user_meta() { * @action updated_user_meta */ public function callback_updated_user_meta() { - call_user_func_array( array( $this, 'check_meta' ), array_merge( array( 'user', 'updated' ), func_get_args() ) ); + $this->check_meta( 'user', 'updated', ...func_get_args() ); } /** @@ -204,7 +403,7 @@ public function callback_updated_user_meta() { * @action delete_user_meta */ public function callback_delete_user_meta() { - call_user_func_array( array( $this, 'check_meta' ), array_merge( array( 'user', 'deleted' ), func_get_args() ) ); + $this->check_meta( 'user', 'deleted', ...func_get_args() ); } /** @@ -219,7 +418,7 @@ public function callback_delete_user_meta() { */ public function check_meta( $type, $action, $meta_id, $object_id, $meta_key, $meta_value = null ) { $post = get_post( $object_id ); - if ( 'post' !== $type || ! $post || 'acf' !== $post->post_type ) { + if ( 'post' !== $type || ! $post || ! in_array( $post->post_type, array( 'acf', 'acf-field-group' ), true ) ) { $this->check_meta_values( $type, $action, $meta_id, $object_id, $meta_key, $meta_value ); return; } @@ -274,7 +473,7 @@ public function check_meta( $type, $action, $meta_id, $object_id, $meta_key, $me ), $object_id, 'options', - 'updated' + $action ); } elseif ( 'layout' === $meta_key ) { if ( 'deleted' === $action ) { @@ -479,10 +678,29 @@ public function log_override( $data ) { return $data; } - if ( 'posts' === $data['connector'] && 'acf' === $data['context'] ) { - $data['context'] = 'field_groups'; - $data['connector'] = $this->name; - $data['args']['singular_name'] = esc_html__( 'field group', 'stream' ); + $is_acf_context = in_array( $data['context'], array( 'acf', 'acf-field-group', 'acf-field' ), true ); + + if ( 'posts' === $data['connector'] && $is_acf_context ) { + // If ACF field group CPT being logged. + if ( 'acf' === $data['context'] || 'acf-field-group' === $data['context'] ) { + $data['context'] = 'field_groups'; + $data['connector'] = $this->name; + $data['args']['singular_name'] = esc_html__( 'field group', 'stream' ); + + // elseif ACF field CPT being logged (ACF v5+ only). + } elseif ( 'acf-field' === $data['context'] ) { + $field_group = get_post( wp_get_post_parent_id( $data['object_id'] ) ); + + $data['context'] = 'fields'; + $data['connector'] = $this->name; + $data['args']['singular_name'] = ! empty( $field_group ) + ? sprintf( + /* translators: %s: field group name */ + esc_html__( 'field in the "%s" field group', 'stream' ), + $field_group->post_title + ) + : esc_html__( 'field', 'stream' ); + } } return $data; diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 52817036d..f6d9740cd 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -17,16 +17,12 @@ - - */local/* - - *.ruleset */tests/* */includes/lib/* */ui/lib/* */vendor/* */build/* - */local/public/* + */local/* */node_modules/* diff --git a/phpunit.xml b/phpunit.xml index 4b301981e..47e6e7211 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,6 +7,12 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" > + + + tests diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 63002091c..f3e85b0e6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,6 +14,31 @@ // @see https://core.trac.wordpress.org/browser/trunk/tests/phpunit/includes/functions.php require_once $_tests_dir . '/includes/functions.php'; +/** + * Force plugins defined in a constant (supplied by phpunit.xml) to be active at runtime. + * + * @filter site_option_active_sitewide_plugins + * @filter option_active_plugins + * + * @param array $active_plugins + * @return array + */ +function xwp_filter_active_plugins_for_phpunit( $active_plugins ) { + $forced_active_plugins = array(); + if ( defined( 'WP_TEST_ACTIVATED_PLUGINS' ) ) { + $forced_active_plugins = preg_split( '/\s*,\s*/', WP_TEST_ACTIVATED_PLUGINS ); + } + + if ( ! empty( $forced_active_plugins ) ) { + foreach ( $forced_active_plugins as $forced_active_plugin ) { + $active_plugins[] = $forced_active_plugin; + } + } + return $active_plugins; +} +tests_add_filter( 'site_option_active_sitewide_plugins', 'xwp_filter_active_plugins_for_phpunit' ); +tests_add_filter( 'option_active_plugins', 'xwp_filter_active_plugins_for_phpunit' ); + tests_add_filter( 'muplugins_loaded', function() { diff --git a/tests/tests/connectors/test-class-connector-acf.php b/tests/tests/connectors/test-class-connector-acf.php new file mode 100644 index 000000000..8259544ef --- /dev/null +++ b/tests/tests/connectors/test-class-connector-acf.php @@ -0,0 +1,295 @@ +plugin->connectors->unload_connectors(); + + // Make partial of Connector_ACF class, with mocked "log" function. + $this->mock = $this->getMockBuilder( Connector_ACF::class ) + ->setMethods( array( 'log' ) ) + ->getMock(); + + // Register connector. + $this->mock->register(); + } + + /** + * Runs after each test + */ + public function tearDown() { + parent::tearDown(); + } + + /** + * Create/Update ACF field group + * + * @param array $config ACF field group configuration. + */ + private function update_acf_field_group( $config = array() ) { + $defaults = array( + 'key' => $this->group_key, + 'title' => 'Test Group', + 'fields' => array(), + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ), + ), + ), + 'menu_order' => 0, + 'position' => 'normal', + 'style' => 'default', + 'label_placement' => 'top', + 'instruction_placement' => 'label', + 'hide_on_screen' => '', + 'active' => true, + 'description' => '', + ); + + return \acf_update_field_group( array_merge( $defaults, $config ) ); + } + + /** + * Create/Update ACF field. + * + * @param array $config ACF field configuration. + */ + private function update_acf_field( $config = array() ) { + $defaults = [ + 'parent' => $this->group_key, + 'key' => uniqid(), + 'label' => 'Test Field', + 'name' => 'test_field', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => 'Yes sir!', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ]; + + return \acf_update_field( array_merge( $defaults, $config ) ); + } + + /** + * Confirm that ACF is installed and active. + */ + public function test_acf_installed_and_activated() { + $this->assertTrue( is_callable( 'acf' ) ); + } + + /** + * Tests the "callback_save_post" callback. + */ + public function test_callback_save_post() { + $this->mock->expects( $this->exactly( 2 ) ) + ->method( 'log' ) + ->withConsecutive( + array( + $this->equalTo( esc_html_x( 'Position of "%1$s" updated to "%2$s"', 'acf', 'stream' ) ), + $this->equalTo( + array( + 'title' => 'Test Group', + 'option_label' => esc_html_x( 'Normal (after content)', 'acf', 'stream' ), + 'option' => 'position', + 'option_value' => 'normal', + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'options' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( esc_html_x( '"%1$s" set to display on "%2$s"', 'acf', 'stream' ) ), + $this->equalTo( + array( + 'title' => 'Test Group', + 'option_label' => esc_html_x( 'No screens', 'acf', 'stream' ), + 'option' => 'hide_on_screen', + 'option_value' => null, + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'options' ), + $this->equalTo( 'updated' ), + ) + ); + + // Register test ACF field group and field to trigger callback. + $this->update_acf_field_group(); + $this->update_acf_field(); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_save_post' ) ); + + // 'acf/update_field_group' is called at the end of "acf_update_field()". + $this->assertSame( 1, did_action( 'acf/update_field_group' ) ); + } + + /** + * Tests the "callback_post_updated" callback. + */ + public function test_callback_post_updated() { + // Register test ACF field group and field for later use. + $field_group = $this->update_acf_field_group(); + $field = $this->update_acf_field(); + + $this->mock->expects( $this->exactly( 1 ) ) + ->method( 'log' ) + ->with( + $this->equalTo( esc_html_x( 'Position of "%1$s" updated to "%2$s"', 'acf', 'stream' ) ), + $this->equalTo( + array( + 'title' => $field_group['title'], + 'option_label' => esc_html_x( 'High (after title)', 'acf', 'stream' ), + 'option' => 'position', + 'option_value' => 'acf_after_title', + ) + ), + $this->equalTo( $field_group['ID'] ), + $this->equalTo( 'options' ), + $this->equalTo( 'updated' ) + ); + + // Update field group. + $field_group['position'] = 'acf_after_title'; + $this->update_acf_field_group( $field_group ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_post_updated' ) ); + + // 'acf/update_field_group' is called at the end of "acf_update_field()". + $this->assertSame( 2, did_action( 'acf/update_field_group' ) ); + } + + /** + * Tests the "check_meta_values" function and some of the connected callbacks. + */ + public function test_check_meta_values() { + // Register test ACF field group and field for later use. + $field_group = $this->update_acf_field_group( + array( + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ), + ), + array( + array( + 'param' => 'current_user', + 'operator' => '==', + 'value' => 'logged_in', + ), + ), + ), + ) + ); + $field = $this->update_acf_field(); + + // Create post for later use. + $post_id = self::factory()->post->create( array( 'post_title' => 'Test post' ) ); + $user_id = self::factory()->user->create( + array( + 'username' => 'testuser', + 'display_name' => 'testuser', + ) + ); + + // Expected log() calls. + $this->mock->expects( $this->exactly( 3 ) ) + ->method( 'log' ) + ->withConsecutive( + array( + $this->equalTo( esc_html_x( '"%1$s" of "%2$s" %3$s updated', 'acf', 'stream' ) ), + $this->equalTo( + array( + 'field_label' => $field['label'], + 'title' => 'Test post', + 'singular_name' => 'post', + 'meta_value' => 'Yes sir!', + 'meta_key' => 'test_field', + 'meta_type' => 'post', + ) + ), + $this->equalTo( $post_id ), + $this->equalTo( 'values' ), + $this->equalTo( 'updated' ) + ), + array( + $this->equalTo( esc_html_x( '"%1$s" of "%2$s" %3$s updated', 'acf', 'stream' ) ), + $this->equalTo( + array( + 'field_label' => $field['label'], + 'title' => 'Test post', + 'singular_name' => 'post', + 'meta_value' => '', + 'meta_key' => 'test_field', + 'meta_type' => 'post', + ) + ), + $this->equalTo( $post_id ), + $this->equalTo( 'values' ), + $this->equalTo( 'updated' ) + ), + array( + $this->equalTo( esc_html_x( '"%1$s" of "%2$s" %3$s updated', 'acf', 'stream' ) ), + $this->equalTo( + array( + 'field_label' => $field['label'], + 'title' => 'testuser', + 'singular_name' => 'user', + 'meta_value' => 'Yes sir!', + 'meta_key' => 'test_field', + 'meta_type' => 'user', + ) + ), + $this->equalTo( $user_id ), + $this->equalTo( 'values' ), + $this->equalTo( 'updated' ) + ) + ); + + // Update custom fields to trigger callback. + update_field( 'test_field', 'Yes sir!', $post_id ); + update_field( 'test_field', '', $post_id ); + + \wp_set_current_user( $user_id ); + update_field( 'test_field', 'Yes sir!', "user_{$user_id}" ); + + // Check callback test actions. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_added_post_meta' ) ); + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_updated_post_meta' ) ); + } +} From 2514b6b26964feecb080742d8cde683f9b9945e1 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 9 Jul 2020 13:55:39 -0400 Subject: [PATCH 02/25] edd-connector test added. --- composer.json | 3 +- composer.lock | 85 ++++-- connectors/class-connector-edd.php | 43 ++- phpunit.xml | 2 +- .../connectors/test-class-connector-edd.php | 287 ++++++++++++++++++ 5 files changed, 367 insertions(+), 53 deletions(-) create mode 100644 tests/tests/connectors/test-class-connector-edd.php diff --git a/composer.json b/composer.json index 2288f29bc..ee50c2353 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "wp-coding-standards/wpcs": "^2.2", "wp-phpunit/wp-phpunit": "^5.4", "wpsh/local": "^0.2.3", - "wpackagist-plugin/advanced-custom-fields": "5.8.12" + "wpackagist-plugin/advanced-custom-fields": "5.8.12", + "wpackagist-plugin/easy-digital-downloads": "^2.9.23" }, "config": { "process-timeout": 600, diff --git a/composer.lock b/composer.lock index 23dea658e..d45b1aa6d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "028b548fadf428b765cbcfc049cc00b2", + "content-hash": "1d58819e7fbef294b0721f50a6564b19", "packages": [ { "name": "composer/installers", @@ -922,20 +922,20 @@ }, { "name": "johnpbloch/wordpress", - "version": "5.4.2", + "version": "5.5.0", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress.git", - "reference": "18c41a328193d6f7425a3cea4e01faa220e90218" + "reference": "d8a952dd4aa7f7d4d8be6fa145840fde4e248450" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/18c41a328193d6f7425a3cea4e01faa220e90218", - "reference": "18c41a328193d6f7425a3cea4e01faa220e90218", + "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/d8a952dd4aa7f7d4d8be6fa145840fde4e248450", + "reference": "d8a952dd4aa7f7d4d8be6fa145840fde4e248450", "shasum": "" }, "require": { - "johnpbloch/wordpress-core": "5.4.2", + "johnpbloch/wordpress-core": "5.5.0", "johnpbloch/wordpress-core-installer": "^1.0 || ^2.0", "php": ">=5.6.20" }, @@ -957,20 +957,20 @@ "cms", "wordpress" ], - "time": "2020-06-10T22:05:43+00:00" + "time": "2020-08-11T18:47:19+00:00" }, { "name": "johnpbloch/wordpress-core", - "version": "5.4.2", + "version": "5.5.0", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "3e67d8b6ee6c11e8ce404da4627117fb7fbf9266" + "reference": "c49d46de4e4c8972b8ed2aebe3e850f4f218186f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/3e67d8b6ee6c11e8ce404da4627117fb7fbf9266", - "reference": "3e67d8b6ee6c11e8ce404da4627117fb7fbf9266", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/c49d46de4e4c8972b8ed2aebe3e850f4f218186f", + "reference": "c49d46de4e4c8972b8ed2aebe3e850f4f218186f", "shasum": "" }, "require": { @@ -978,7 +978,7 @@ "php": ">=5.6.20" }, "provide": { - "wordpress/core-implementation": "5.4.2" + "wordpress/core-implementation": "5.5.0" }, "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", @@ -998,7 +998,7 @@ "cms", "wordpress" ], - "time": "2020-06-10T22:05:38+00:00" + "time": "2020-08-11T18:47:13+00:00" }, { "name": "johnpbloch/wordpress-core-installer", @@ -1881,6 +1881,7 @@ "keywords": [ "tokenizer" ], + "abandoned": true, "time": "2017-12-04T08:55:13+00:00" }, { @@ -2726,16 +2727,16 @@ }, { "name": "seld/jsonlint", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1" + "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1", - "reference": "ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/3d5eb71705adfa34bd34b993400622932b2f62fd", + "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd", "shasum": "" }, "require": { @@ -2771,7 +2772,17 @@ "parser", "validator" ], - "time": "2020-04-30T19:05:18+00:00" + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", + "type": "tidelift" + } + ], + "time": "2020-08-13T09:07:59+00:00" }, { "name": "seld/phar-utils", @@ -2819,16 +2830,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.5", + "version": "3.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, "require": { @@ -2866,7 +2877,7 @@ "phpcs", "standards" ], - "time": "2020-04-17T01:09:41+00:00" + "time": "2020-08-10T04:50:15+00:00" }, { "name": "symfony/config", @@ -5960,16 +5971,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.4.2", + "version": "5.5.0", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "15925e03c8594c08cf2822e24e511af8dc6f779e" + "reference": "5cf5a40954b8c47941afdc08b0000ce42efe5993" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/15925e03c8594c08cf2822e24e511af8dc6f779e", - "reference": "15925e03c8594c08cf2822e24e511af8dc6f779e", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/5cf5a40954b8c47941afdc08b0000ce42efe5993", + "reference": "5cf5a40954b8c47941afdc08b0000ce42efe5993", "shasum": "" }, "type": "library", @@ -5999,7 +6010,7 @@ "test", "wordpress" ], - "time": "2020-04-01T14:35:27+00:00" + "time": "2020-08-12T15:43:21+00:00" }, { "name": "wpackagist-plugin/advanced-custom-fields", @@ -6019,6 +6030,24 @@ "type": "wordpress-plugin", "homepage": "https://wordpress.org/plugins/advanced-custom-fields/" }, + { + "name": "wpackagist-plugin/easy-digital-downloads", + "version": "2.9.23", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/easy-digital-downloads/", + "reference": "tags/2.9.23" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.23.zip" + }, + "require": { + "composer/installers": "~1.0" + }, + "type": "wordpress-plugin", + "homepage": "https://wordpress.org/plugins/easy-digital-downloads/" + }, { "name": "wpsh/local", "version": "0.2.3", diff --git a/connectors/class-connector-edd.php b/connectors/class-connector-edd.php index 7c2e51485..6074e9fb9 100644 --- a/connectors/class-connector-edd.php +++ b/connectors/class-connector-edd.php @@ -330,14 +330,8 @@ public function check( $option, $old_value, $new_value ) { $replacement = str_replace( '-', '_', $option ); if ( method_exists( $this, 'check_' . $replacement ) ) { - call_user_func( - array( - $this, - 'check_' . $replacement, - ), - $old_value, - $new_value - ); + $method = "check_{$replacement}"; + $this->{$method}( $old_value, $new_value ); } else { $data = $this->options[ $option ]; $option_title = $data['label']; @@ -376,6 +370,7 @@ public function check_edd_settings( $old_value, $new_value ) { foreach ( $options as $option => $option_value ) { $field = null; + $tab = null; if ( 'banned_email' === $option ) { $field = array( @@ -383,10 +378,13 @@ public function check_edd_settings( $old_value, $new_value ) { ); $tab = 'general'; } else { - foreach ( $settings as $tab => $fields ) { - if ( isset( $fields[ $option ] ) ) { - $field = $fields[ $option ]; - break; + foreach ( $settings as $current_tab => $tab_sections ) { + foreach ( $tab_sections as $section => $section_fields ) { + if ( in_array( $option, array_keys( $section_fields ), true ) ) { + $field = $section_fields[ $option ]; + $tab = $current_tab; + break; + } } } } @@ -401,8 +399,8 @@ public function check_edd_settings( $old_value, $new_value ) { array( 'option_title' => $field['name'], 'option' => $option, - 'old_value' => $old_value, - 'value' => $new_value, + 'old_value' => isset( $old_value[ $option ] ) ? $old_value[ $option ] : null, + 'value' => isset( $new_value[ $option ] ) ? $new_value[ $option ] : null, 'tab' => $tab, ), null, @@ -652,6 +650,12 @@ public function callback_delete_user_meta( $meta_id, $object_id, $meta_key, $_me * @param bool $is_add Is this a new meta?. */ public function meta( $object_id, $key, $value, $is_add = false ) { + // For catching "edd_user_public_key" in newer versions of EDD. + if ( in_array( $value, $this->user_meta, true ) ) { + $key = $value; + $value = 1; // Probably, should avoid storing the api key. + } + if ( ! in_array( $key, $this->user_meta, true ) ) { return false; } @@ -662,15 +666,8 @@ public function meta( $object_id, $key, $value, $is_add = false ) { return false; } - return call_user_func( - array( - $this, - 'meta_' . $key, - ), - $object_id, - $value, - $is_add - ); + $method = "meta_{$key}"; + return $this->{$method}( $object_id, $value, $is_add ); } /** diff --git a/phpunit.xml b/phpunit.xml index 47e6e7211..a982b0cc7 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -10,7 +10,7 @@ diff --git a/tests/tests/connectors/test-class-connector-edd.php b/tests/tests/connectors/test-class-connector-edd.php new file mode 100644 index 000000000..bb457995f --- /dev/null +++ b/tests/tests/connectors/test-class-connector-edd.php @@ -0,0 +1,287 @@ +plugin->connectors->unload_connectors(); + + $post_connector = new Connector_Posts(); + $post_connector->register(); + + // Make partial of Connector_EDD class, with mocked "log" function. + $this->mock = $this->getMockBuilder( Connector_EDD::class ) + ->setMethods( [ 'log' ] ) + ->getMock(); + + $this->mock->register(); + } + + /** + * Runs after each test + */ + public function tearDown() { + parent::tearDown(); + } + + /** + * Create a download + * + * @return int + */ + private function create_simple_download() { + $post_id = wp_insert_post( array( + 'post_title' => 'Test Download Product', + 'post_name' => 'test-download-product', + 'post_type' => 'download', + 'post_status' => 'publish' + ) ); + + $_download_files = array( + array( + 'name' => 'Simple File 1', + 'file' => 'http://localhost/simple-file1.jpg', + 'condition' => 0 + ), + ); + + $meta = array( + 'edd_price' => '20.00', + '_variable_pricing' => 0, + 'edd_variable_prices' => false, + 'edd_download_files' => array_values( $_download_files ), + '_edd_download_limit' => 20, + '_edd_hide_purchase_link' => 1, + 'edd_product_notes' => 'Purchase Notes', + '_edd_product_type' => 'default', + '_edd_download_earnings' => 40, + '_edd_download_sales' => 2, + '_edd_download_limit_override_1' => 1, + 'edd_sku' => 'sku_0012' + ); + + foreach( $meta as $key => $value ) { + update_post_meta( $post_id, $key, $value ); + } + + return get_post( $post_id ); + } + + /** + * Create a percentage discount + * + * @return int + */ + private function create_simple_percent_discount() { + $post = array( + 'code' => '20OFF', + 'uses' => 54, + 'max' => 10, + 'name' => '20 Percent Off', + 'type' => 'percent', + 'amount' => '20', + 'start' => '12/12/2010 00:00:00', + 'expiration' => '12/31/2050 23:59:59', + 'min_price' => 128, + 'status' => 'active', + 'product_condition' => 'all' + ); + $discount_id = edd_store_discount( $post ); + + return $discount_id; + } + + public function test_edd_installed_and_activated() { + $this->assertTrue( class_exists( 'Easy_Digital_Downloads' ) ); + } + + public function test_check() { + // Expected log calls. + $this->mock->expects( $this->exactly( 3 ) ) + ->method( 'log' ) + ->withConsecutive( + [ + $this->equalTo( __( '"%s" setting updated', 'stream' ) ), + $this->equalTo( + array( + 'option_title' => 'Thousands Separator', + 'option' => 'thousands_separator', + 'old_value' => null, + 'value' => '.', + 'tab' => 'general', + ) + ), + $this->equalTo( null ), + $this->equalTo( 'settings' ), + $this->equalTo( 'updated' ) + ], + [ + $this->equalTo( __( '"%s" setting updated', 'stream' ) ), + $this->equalTo( + array( + 'option_title' => 'Thousands Separator', + 'option' => 'thousands_separator', + 'old_value' => '.', + 'value' => ',', + 'tab' => 'general', + ) + ), + $this->equalTo( null ), + $this->equalTo( 'settings' ), + $this->equalTo( 'updated' ) + ], + [ + $this->equalTo( __( '"%s" setting updated', 'stream' ) ), + $this->equalTo( + array( + 'option_title' => 'Thousands Separator', + 'option' => 'thousands_separator', + 'old_value' => ',', + 'value' => null, + 'tab' => 'general', + ) + ), + $this->equalTo( null ), + $this->equalTo( 'settings' ), + $this->equalTo( 'updated' ) + ] + ); + + // Update option to trigger callback. + edd_update_option( 'thousands_separator', '.' ); + edd_update_option( 'thousands_separator', ',' ); + edd_update_option( 'thousands_separator' ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_add_option' ) ); + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_update_option' ) ); + } + + public function test_log_override() { + // Callback for validating expected log data. + $asserted = 0; + add_action( + 'wp_stream_log_data', + function( $data ) use( &$asserted ) { + if ( 'edd' === $data['connector'] && in_array( $data['context'], array( 'downloads', 'discounts' ), true ) ) { + $asserted++; + } + + return $data; + }, + 99 + ); + + // Create download and discount to trigger logs. + $this->create_simple_download(); + $this->create_simple_percent_discount(); + + // Check assertion flage + $this->assertSame( $asserted, 2 ); + } + + public function test_callback_edd_pre_update_discount_status() { + // Create discount for later use. + $post_id = $this->create_simple_percent_discount(); + $discount = new \EDD_Discount( $post_id ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + sprintf( + __( '"%1$s" discount %2$s', 'stream' ), + $discount->name, + esc_html__( 'deactivated', 'stream' ) + ) + ), + $this->equalTo( + [ + 'post_id' => $post_id, + 'status' => 'inactive', + ] + ), + $this->equalTo( $post_id ), + $this->equalTo( 'discounts' ), + $this->equalTo( 'updated' ) + ); + + // Update discount status to trigger callback. + $discount->update_status( 'inactive' ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edd_pre_update_discount_status' ) ); + } + + public function test_settings_transport_callbacks() { + // Expected log calls. + $this->mock->expects( $this->exactly( 2 ) ) + ->method( 'log' ) + ->withConsecutive( + [ + $this->equalTo( __( 'Imported Settings', 'stream' ) ), + $this->equalTo( array() ), + $this->equalTo( null ), + $this->equalTo( 'settings' ), + $this->equalTo( 'imported' ), + ], + [ + $this->equalTo( __( 'Exported Settings', 'stream' ) ), + $this->equalTo( array() ), + $this->equalTo( null ), + $this->equalTo( 'settings' ), + $this->equalTo( 'exported' ), + ] + ); + + // Manually trigger callbacks. + do_action( 'edd_import_settings' ); + do_action( 'edd_export_settings' ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edd_import_settings' ) ); + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edd_export_settings' ) ); + } + + public function test_meta() { + // Create and authenticate user. + $user_id = self::factory()->user->create( [ 'role' => 'administrator' ] ); + \wp_set_current_user( $user_id ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( __( 'User API Key created', 'stream' ) ), + $this->equalTo( [ 'meta_value' => 1 ] ), + $this->equalTo( $user_id ), + $this->equalTo( 'api_keys' ), + 'created' + ); + + // Update API key and trigger callback.. + $_POST['edd_set_api_key'] = 1; + \edd_update_user_api_key( $user_id ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_add_user_meta' ) ); + } +} From 8c8673315735c1b7bd16c933469b5a7f0ed6836e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 14 Aug 2020 21:48:15 +0000 Subject: [PATCH 03/25] Update dependency eslint to ^7.7.0 --- package-lock.json | 32 +++++++++++++++----------------- package.json | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index b32490131..485b1fcfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -263,14 +263,6 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" - }, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - } } }, "@wordpress/prettier-config": { @@ -286,9 +278,9 @@ "dev": true }, "acorn": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", - "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", + "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", "dev": true }, "acorn-jsx": { @@ -1132,9 +1124,9 @@ "dev": true }, "eslint": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.5.0.tgz", - "integrity": "sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q==", + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.7.0.tgz", + "integrity": "sha512-1KUxLzos0ZVsyL81PnRN335nDtQ8/vZUD6uMtWbF+5zDtjKcsklIi78XoE0MVL93QvWTu+E5y44VyyCsOMBrIg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1434,9 +1426,9 @@ }, "dependencies": { "estraverse": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", - "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", "dev": true } } @@ -3341,6 +3333,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/package.json b/package.json index 6427215c2..c98b37d84 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "@wordpress/eslint-plugin": "^7.1.0", - "eslint": "^7.5.0", + "eslint": "^7.7.0", "grunt": "~1.2.1", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", From cbfc6da0b83896c2a6b11ddbd4f3a1bc27e41620 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 18 Aug 2020 19:51:41 +0000 Subject: [PATCH 04/25] Update dependency grunt to ~1.3.0 --- package-lock.json | 114 +++++++++++++++++++++++++++++++++++----------- package.json | 2 +- 2 files changed, 89 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index 485b1fcfe..5f95d2d6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -263,6 +263,14 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" + }, + "dependencies": { + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + } } }, "@wordpress/prettier-config": { @@ -1953,9 +1961,9 @@ "dev": true }, "grunt": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.2.1.tgz", - "integrity": "sha512-zgJjn9N56tScvRt/y0+1QA+zDBnKTrkpyeSBqQPLcZvbqTD/oyGMrdZQXmm6I3828s+FmPvxc3Xv+lgKFtudOw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.3.0.tgz", + "integrity": "sha512-6ILlMXv11/4cxuhSMfSU+SfvbxrPuqZrAtLN64+tZpQ3DAKfSQPQHRbTjSbdtxfyQhGZPtN0bDZJ/LdCM5WXXA==", "dev": true, "requires": { "dateformat": "~3.0.3", @@ -1965,8 +1973,8 @@ "glob": "~7.1.6", "grunt-cli": "~1.3.2", "grunt-known-options": "~1.1.0", - "grunt-legacy-log": "~2.0.0", - "grunt-legacy-util": "~1.1.1", + "grunt-legacy-log": "~3.0.0", + "grunt-legacy-util": "~2.0.0", "iconv-lite": "~0.4.13", "js-yaml": "~3.14.0", "minimatch": "~3.0.4", @@ -2160,40 +2168,100 @@ "dev": true }, "grunt-legacy-log": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-2.0.0.tgz", - "integrity": "sha512-1m3+5QvDYfR1ltr8hjiaiNjddxGdQWcH0rw1iKKiQnF0+xtgTazirSTGu68RchPyh1OBng1bBUjLmX8q9NpoCw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz", + "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==", "dev": true, "requires": { "colors": "~1.1.2", - "grunt-legacy-log-utils": "~2.0.0", + "grunt-legacy-log-utils": "~2.1.0", "hooker": "~0.2.3", - "lodash": "~4.17.5" + "lodash": "~4.17.19" } }, "grunt-legacy-log-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.0.1.tgz", - "integrity": "sha512-o7uHyO/J+i2tXG8r2bZNlVk20vlIFJ9IEYyHMCQGfWYru8Jv3wTqKZzvV30YW9rWEjq0eP3cflQ1qWojIe9VFA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz", + "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==", "dev": true, "requires": { - "chalk": "~2.4.1", - "lodash": "~4.17.10" + "chalk": "~4.1.0", + "lodash": "~4.17.19" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "grunt-legacy-util": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.1.1.tgz", - "integrity": "sha512-9zyA29w/fBe6BIfjGENndwoe1Uy31BIXxTH3s8mga0Z5Bz2Sp4UCjkeyv2tI449ymkx3x26B+46FV4fXEddl5A==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.0.tgz", + "integrity": "sha512-ZEmYFB44bblwPE2oz3q3ygfF6hseQja9tx8I3UZIwbUik32FMWewA+d1qSFicMFB+8dNXDkh35HcDCWlpRsGlA==", "dev": true, "requires": { "async": "~1.5.2", "exit": "~0.1.1", "getobject": "~0.1.0", "hooker": "~0.2.3", - "lodash": "~4.17.10", - "underscore.string": "~3.3.4", + "lodash": "~4.17.20", + "underscore.string": "~3.3.5", "which": "~1.3.0" + }, + "dependencies": { + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + } } }, "grunt-wp-deploy": { @@ -3333,12 +3401,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/package.json b/package.json index c98b37d84..0998f322d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "devDependencies": { "@wordpress/eslint-plugin": "^7.1.0", "eslint": "^7.7.0", - "grunt": "~1.2.1", + "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", "grunt-contrib-copy": "~1.0.0", From 776294a21b2f48bacc57e3af4ecce9af47c26176 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 27 Aug 2020 16:08:22 -0400 Subject: [PATCH 05/25] ".load()" calls replaced valid equivalent." --- ui/js/admin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/js/admin.js b/ui/js/admin.js index 1e7ac4856..aa07f549c 100644 --- a/ui/js/admin.js +++ b/ui/js/admin.js @@ -141,7 +141,8 @@ jQuery( } ); - $( window ).load( + $( window ).on( + 'load', function() { $( '.toplevel_page_wp_stream input[type="search"]' ).off( 'mousedown' ); } From bc11012b5cb3c06252048a76a2adceced8d7a149 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 31 Aug 2020 22:48:46 +0000 Subject: [PATCH 06/25] Update dependency eslint to ^7.8.0 --- package-lock.json | 61 ++++++++++++++++++++++++++++------------------- package.json | 2 +- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f95d2d6b..2bcb3abba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -184,6 +184,18 @@ "to-fast-properties": "^2.0.0" } }, + "@eslint/eslintrc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.0.tgz", + "integrity": "sha512-bfL5365QSCmH6cPeFT7Ywclj8C7LiF7sO6mUGzZhtAMV7iID1Euq6740u/SRi4C80NOnVz/CEfK8/HO+nCAPJg==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "import-fresh": "^3.2.1", + "strip-json-comments": "^3.1.1" + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -263,14 +275,6 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" - }, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - } } }, "@wordpress/prettier-config": { @@ -298,9 +302,9 @@ "dev": true }, "ajv": { - "version": "6.12.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", - "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", + "version": "6.12.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz", + "integrity": "sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -1132,12 +1136,13 @@ "dev": true }, "eslint": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.7.0.tgz", - "integrity": "sha512-1KUxLzos0ZVsyL81PnRN335nDtQ8/vZUD6uMtWbF+5zDtjKcsklIi78XoE0MVL93QvWTu+E5y44VyyCsOMBrIg==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.8.0.tgz", + "integrity": "sha512-qgtVyLZqKd2ZXWnLQA4NtVbOyH56zivOAdBFWE54RFkSZjokzNrcP4Z0eVWsZ+84ByXv+jL9k/wE1ENYe8xRFw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.1.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1147,7 +1152,7 @@ "eslint-scope": "^5.1.0", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^1.3.0", - "espree": "^7.2.0", + "espree": "^7.3.0", "esquery": "^1.2.0", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", @@ -1262,9 +1267,9 @@ } }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -1400,12 +1405,12 @@ "dev": true }, "espree": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.2.0.tgz", - "integrity": "sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", + "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", "dev": true, "requires": { - "acorn": "^7.3.1", + "acorn": "^7.4.0", "acorn-jsx": "^5.2.0", "eslint-visitor-keys": "^1.3.0" }, @@ -3401,6 +3406,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", @@ -4381,9 +4392,9 @@ } }, "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", "dev": true, "requires": { "punycode": "^2.1.0" diff --git a/package.json b/package.json index 0998f322d..beb27f8e3 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "@wordpress/eslint-plugin": "^7.1.0", - "eslint": "^7.7.0", + "eslint": "^7.8.0", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", From 3250146245ffcfb9e0a3f0a83579512de3ee38c7 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Tue, 1 Sep 2020 17:52:47 -0400 Subject: [PATCH 07/25] taxonomies connector test implemented. --- .../test-class-connector-taxonomies.php | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 tests/tests/connectors/test-class-connector-taxonomies.php diff --git a/tests/tests/connectors/test-class-connector-taxonomies.php b/tests/tests/connectors/test-class-connector-taxonomies.php new file mode 100644 index 000000000..2a4ee5383 --- /dev/null +++ b/tests/tests/connectors/test-class-connector-taxonomies.php @@ -0,0 +1,143 @@ +plugin->connectors->unload_connectors(); + + // Make partial of Connector_Taxonomies class, with mocked "log" function. + $this->mock = $this->getMockBuilder( Connector_Taxonomies::class ) + ->setMethods( array( 'log' ) ) + ->getMock(); + + // Register connector. + $this->mock->register(); + $this->mock->get_context_labels(); + } + + public function test_callback_created_term() { + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + '"%1$s" %2$s created', + '1: Term name, 2: Taxonomy singular label', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'term_name' => 'test', + 'taxonomy_label' => 'Category', + 'taxonomy' => 'category', + 'term_parent' => 0 + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'category' ), + $this->equalTo( 'created' ) + ); + + // Create term to trigger callback. + wp_insert_term( 'test', 'category' ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_created_term' ) ); + } + + public function test_callback_delete_term() { + // Create term for later use. + $term_data = wp_insert_term( 'test', 'category' ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + '"%1$s" %2$s deleted', + '1: Term name, 2: Taxonomy singular label', + 'stream' + ) + ), + $this->equalTo( + array( + 'term_name' => 'test', + 'taxonomy_label' => 'category', + 'term_id' => $term_data['term_id'], + 'taxonomy' => 'category', + 'term_parent' => 0 + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'category' ), + $this->equalTo( 'deleted' ) + ); + + // Delete term to trigger callback. + wp_delete_term( $term_data['term_id'], 'category' ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_delete_term' ) ); + } + + public function test_callback_edited_term() { + // Create term for later use. + $term_data = wp_insert_term( 'test', 'category' ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + '"%1$s" %2$s updated', + '1: Term name, 2: Taxonomy singular label', + 'stream' + ) + ), + $this->equalTo( + array( + 'term_name' => 'test', + 'taxonomy_label' => 'category', + 'term_id' => $term_data['term_id'], + 'taxonomy' => 'category', + 'term_parent' => 0 + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'category' ), + $this->equalTo( 'updated' ) + ); + + // Edit term to trigger callbacks. + $this->assertFalse( + is_wp_error( + wp_update_term( + $term_data['term_id'], + 'category', + array( 'name' => 'testing' ) + ) + ) + ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edit_term' ) ); + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edited_term' ) ); + } +} From 788ee14767369193b6d1ea947ddee5c3ae9d7550 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 1 Sep 2020 20:47:31 +0000 Subject: [PATCH 08/25] Update dependency eslint to ^7.8.1 --- package-lock.json | 34 +++++++++++++++++++++------------- package.json | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2bcb3abba..742568348 100644 --- a/package-lock.json +++ b/package-lock.json @@ -185,14 +185,20 @@ } }, "@eslint/eslintrc": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.0.tgz", - "integrity": "sha512-bfL5365QSCmH6cPeFT7Ywclj8C7LiF7sO6mUGzZhtAMV7iID1Euq6740u/SRi4C80NOnVz/CEfK8/HO+nCAPJg==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz", + "integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" } }, @@ -275,6 +281,14 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" + }, + "dependencies": { + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + } } }, "@wordpress/prettier-config": { @@ -1136,13 +1150,13 @@ "dev": true }, "eslint": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.8.0.tgz", - "integrity": "sha512-qgtVyLZqKd2ZXWnLQA4NtVbOyH56zivOAdBFWE54RFkSZjokzNrcP4Z0eVWsZ+84ByXv+jL9k/wE1ENYe8xRFw==", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.8.1.tgz", + "integrity": "sha512-/2rX2pfhyUG0y+A123d0ccXtMm7DV7sH1m3lk9nk2DZ2LReq39FXHueR9xZwshE5MdfSf0xunSaMWRqyIA6M1w==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.1.0", + "@eslint/eslintrc": "^0.1.3", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -3406,12 +3420,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/package.json b/package.json index beb27f8e3..f84980f3d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "@wordpress/eslint-plugin": "^7.1.0", - "eslint": "^7.8.0", + "eslint": "^7.8.1", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", From 630ead1da577d7de4943b73fdb85c3c12f6d0e81 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 3 Sep 2020 18:54:46 -0400 Subject: [PATCH 09/25] User Switching connector test added. --- composer.json | 3 +- composer.lock | 164 +++++++++++------- phpunit.xml | 2 +- .../test-class-connector-user-switching.php | 45 +++++ 4 files changed, 153 insertions(+), 61 deletions(-) create mode 100644 tests/tests/connectors/test-class-connector-user-switching.php diff --git a/composer.json b/composer.json index ee50c2353..9989fa6f3 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "wp-phpunit/wp-phpunit": "^5.4", "wpsh/local": "^0.2.3", "wpackagist-plugin/advanced-custom-fields": "5.8.12", - "wpackagist-plugin/easy-digital-downloads": "^2.9.23" + "wpackagist-plugin/easy-digital-downloads": "^2.9.23", + "wpackagist-plugin/user-switching": "^1.5.5" }, "config": { "process-timeout": 600, diff --git a/composer.lock b/composer.lock index d45b1aa6d..7ccbc78ad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1d58819e7fbef294b0721f50a6564b19", + "content-hash": "9ea430268ec38a2b87542c340bc6f5fe", "packages": [ { "name": "composer/installers", @@ -183,16 +183,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.2.7", + "version": "1.2.8", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" + "reference": "8a7ecad675253e4654ea05505233285377405215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215", + "reference": "8a7ecad675253e4654ea05505233285377405215", "shasum": "" }, "require": { @@ -235,7 +235,21 @@ "ssl", "tls" ], - "time": "2020-04-08T08:27:21+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-23T12:54:47+00:00" }, { "name": "composer/composer", @@ -468,16 +482,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ebd27a9866ae8254e873866f795491f02418c5a5", + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5", "shasum": "" }, "require": { @@ -508,7 +522,21 @@ "Xdebug", "performance" ], - "time": "2020-06-04T11:16:35+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-19T10:27:58+00:00" }, { "name": "cweagans/composer-patches", @@ -922,20 +950,20 @@ }, { "name": "johnpbloch/wordpress", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress.git", - "reference": "d8a952dd4aa7f7d4d8be6fa145840fde4e248450" + "reference": "0973abd5c01ecce0b60bc1c81a6dd072827de930" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/d8a952dd4aa7f7d4d8be6fa145840fde4e248450", - "reference": "d8a952dd4aa7f7d4d8be6fa145840fde4e248450", + "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/0973abd5c01ecce0b60bc1c81a6dd072827de930", + "reference": "0973abd5c01ecce0b60bc1c81a6dd072827de930", "shasum": "" }, "require": { - "johnpbloch/wordpress-core": "5.5.0", + "johnpbloch/wordpress-core": "5.5.1", "johnpbloch/wordpress-core-installer": "^1.0 || ^2.0", "php": ">=5.6.20" }, @@ -957,20 +985,20 @@ "cms", "wordpress" ], - "time": "2020-08-11T18:47:19+00:00" + "time": "2020-09-01T19:07:41+00:00" }, { "name": "johnpbloch/wordpress-core", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "c49d46de4e4c8972b8ed2aebe3e850f4f218186f" + "reference": "fa5bcb1579eae33baef6c04355f8d6657e5bd349" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/c49d46de4e4c8972b8ed2aebe3e850f4f218186f", - "reference": "c49d46de4e4c8972b8ed2aebe3e850f4f218186f", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/fa5bcb1579eae33baef6c04355f8d6657e5bd349", + "reference": "fa5bcb1579eae33baef6c04355f8d6657e5bd349", "shasum": "" }, "require": { @@ -978,7 +1006,7 @@ "php": ">=5.6.20" }, "provide": { - "wordpress/core-implementation": "5.5.0" + "wordpress/core-implementation": "5.5.1" }, "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", @@ -998,7 +1026,7 @@ "cms", "wordpress" ], - "time": "2020-08-11T18:47:13+00:00" + "time": "2020-09-01T19:07:35+00:00" }, { "name": "johnpbloch/wordpress-core-installer", @@ -2727,16 +2755,16 @@ }, { "name": "seld/jsonlint", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd" + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/3d5eb71705adfa34bd34b993400622932b2f62fd", - "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/590cfec960b77fd55e39b7d9246659e95dd6d337", + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337", "shasum": "" }, "require": { @@ -2782,7 +2810,7 @@ "type": "tidelift" } ], - "time": "2020-08-13T09:07:59+00:00" + "time": "2020-08-25T06:56:57+00:00" }, { "name": "seld/phar-utils", @@ -2881,16 +2909,16 @@ }, { "name": "symfony/config", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "9e2aa97f0d51f114983666f5aa362426d53e004a" + "reference": "801a3bbc17fb1ba44b0d7d41a6db7a0b74953595" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9e2aa97f0d51f114983666f5aa362426d53e004a", - "reference": "9e2aa97f0d51f114983666f5aa362426d53e004a", + "url": "https://api.github.com/repos/symfony/config/zipball/801a3bbc17fb1ba44b0d7d41a6db7a0b74953595", + "reference": "801a3bbc17fb1ba44b0d7d41a6db7a0b74953595", "shasum": "" }, "require": { @@ -2955,20 +2983,20 @@ "type": "tidelift" } ], - "time": "2020-07-23T09:37:51+00:00" + "time": "2020-08-10T07:13:15+00:00" }, { "name": "symfony/console", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "afc7189694d2c59546cf24ea606a236fa46a966e" + "reference": "71da881ad579f0cd66aef8677e4cf6217d8ecd0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/afc7189694d2c59546cf24ea606a236fa46a966e", - "reference": "afc7189694d2c59546cf24ea606a236fa46a966e", + "url": "https://api.github.com/repos/symfony/console/zipball/71da881ad579f0cd66aef8677e4cf6217d8ecd0c", + "reference": "71da881ad579f0cd66aef8677e4cf6217d8ecd0c", "shasum": "" }, "require": { @@ -3041,20 +3069,20 @@ "type": "tidelift" } ], - "time": "2020-07-06T08:57:31+00:00" + "time": "2020-08-09T08:16:57+00:00" }, { "name": "symfony/debug", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "7ce874f4432d8b11cc45a80cc5130a6e2609728d" + "reference": "0893a0b07c499a1530614d65869ea6a7b1b8a164" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/7ce874f4432d8b11cc45a80cc5130a6e2609728d", - "reference": "7ce874f4432d8b11cc45a80cc5130a6e2609728d", + "url": "https://api.github.com/repos/symfony/debug/zipball/0893a0b07c499a1530614d65869ea6a7b1b8a164", + "reference": "0893a0b07c499a1530614d65869ea6a7b1b8a164", "shasum": "" }, "require": { @@ -3111,20 +3139,20 @@ "type": "tidelift" } ], - "time": "2020-07-16T09:41:49+00:00" + "time": "2020-08-09T08:13:48+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "0f625d0cb1e59c8c4ba61abb170125175218ff10" + "reference": "8e6eff546d0fe879996fa701ee2f312767e95e50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f625d0cb1e59c8c4ba61abb170125175218ff10", - "reference": "0f625d0cb1e59c8c4ba61abb170125175218ff10", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8e6eff546d0fe879996fa701ee2f312767e95e50", + "reference": "8e6eff546d0fe879996fa701ee2f312767e95e50", "shasum": "" }, "require": { @@ -3175,11 +3203,11 @@ "type": "tidelift" } ], - "time": "2020-05-30T17:48:24+00:00" + "time": "2020-08-21T12:53:49+00:00" }, { "name": "symfony/finder", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3711,7 +3739,7 @@ }, { "name": "symfony/process", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -3774,7 +3802,7 @@ }, { "name": "symfony/stopwatch", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -3837,16 +3865,16 @@ }, { "name": "symfony/yaml", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e7fa05917ae931332a42d65b577ece4d497aad81" + "reference": "4152e36b0f305c2a57aa0233dee56ec27bca4f06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e7fa05917ae931332a42d65b577ece4d497aad81", - "reference": "e7fa05917ae931332a42d65b577ece4d497aad81", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4152e36b0f305c2a57aa0233dee56ec27bca4f06", + "reference": "4152e36b0f305c2a57aa0233dee56ec27bca4f06", "shasum": "" }, "require": { @@ -3906,7 +3934,7 @@ "type": "tidelift" } ], - "time": "2020-07-23T09:37:51+00:00" + "time": "2020-08-26T06:32:27+00:00" }, { "name": "webmozart/assert", @@ -6032,15 +6060,15 @@ }, { "name": "wpackagist-plugin/easy-digital-downloads", - "version": "2.9.23", + "version": "2.9.24", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/easy-digital-downloads/", - "reference": "tags/2.9.23" + "reference": "tags/2.9.24" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.23.zip" + "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.24.zip" }, "require": { "composer/installers": "~1.0" @@ -6048,6 +6076,24 @@ "type": "wordpress-plugin", "homepage": "https://wordpress.org/plugins/easy-digital-downloads/" }, + { + "name": "wpackagist-plugin/user-switching", + "version": "1.5.5", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/user-switching/", + "reference": "tags/1.5.5" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/user-switching.1.5.5.zip" + }, + "require": { + "composer/installers": "~1.0" + }, + "type": "wordpress-plugin", + "homepage": "https://wordpress.org/plugins/user-switching/" + }, { "name": "wpsh/local", "version": "0.2.3", diff --git a/phpunit.xml b/phpunit.xml index a982b0cc7..af2b1c44b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -10,7 +10,7 @@ diff --git a/tests/tests/connectors/test-class-connector-user-switching.php b/tests/tests/connectors/test-class-connector-user-switching.php new file mode 100644 index 000000000..6029ce114 --- /dev/null +++ b/tests/tests/connectors/test-class-connector-user-switching.php @@ -0,0 +1,45 @@ +plugin->connectors->unload_connectors(); + + // Make partial of Connector_User_Switching class, with mocked "log" function. + $this->mock = $this->getMockBuilder( Connector_User_Switching::class ) + ->setMethods( array( 'log' ) ) + ->getMock(); + + // Register connector. + $this->mock->register(); + } + + public function test_callback_switch_to_user() { + + } + + public function test_callback_switch_back_user() { + + } + + public function test_callback_switch_off_user() { + + } + + public function test_callback_wp_stream_after_connectors_registration() { + + } +} From ad3cdfa9da9e185c25155b90460144541051b217 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Fri, 4 Sep 2020 16:30:32 -0400 Subject: [PATCH 10/25] User Switching connector test implemented. --- composer.lock | 16 +-- connectors/class-connector-user-switching.php | 6 +- .../test-class-connector-user-switching.php | 124 +++++++++++++++++- 3 files changed, 131 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index 7ccbc78ad..4e5401620 100644 --- a/composer.lock +++ b/composer.lock @@ -5999,16 +5999,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "5cf5a40954b8c47941afdc08b0000ce42efe5993" + "reference": "763121e752594664c150643e05c991a0acf3800a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/5cf5a40954b8c47941afdc08b0000ce42efe5993", - "reference": "5cf5a40954b8c47941afdc08b0000ce42efe5993", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/763121e752594664c150643e05c991a0acf3800a", + "reference": "763121e752594664c150643e05c991a0acf3800a", "shasum": "" }, "type": "library", @@ -6038,7 +6038,7 @@ "test", "wordpress" ], - "time": "2020-08-12T15:43:21+00:00" + "time": "2020-09-02T15:53:50+00:00" }, { "name": "wpackagist-plugin/advanced-custom-fields", @@ -6060,15 +6060,15 @@ }, { "name": "wpackagist-plugin/easy-digital-downloads", - "version": "2.9.24", + "version": "2.9.25", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/easy-digital-downloads/", - "reference": "tags/2.9.24" + "reference": "tags/2.9.25" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.24.zip" + "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.25.zip" }, "require": { "composer/installers": "~1.0" diff --git a/connectors/class-connector-user-switching.php b/connectors/class-connector-user-switching.php index 78f792c59..8639a790e 100644 --- a/connectors/class-connector-user-switching.php +++ b/connectors/class-connector-user-switching.php @@ -219,13 +219,9 @@ public function callback_switch_back_user( $user_id, $old_user_id ) { public function callback_switch_off_user( $old_user_id ) { $old_user = get_userdata( $old_user_id ); - $message = __( - 'Switched off', - 'stream' - ); $this->log( - $message, + __( 'Switched off', 'stream' ), array(), $old_user->ID, 'sessions', diff --git a/tests/tests/connectors/test-class-connector-user-switching.php b/tests/tests/connectors/test-class-connector-user-switching.php index 6029ce114..04f6b8944 100644 --- a/tests/tests/connectors/test-class-connector-user-switching.php +++ b/tests/tests/connectors/test-class-connector-user-switching.php @@ -27,19 +27,139 @@ public function setUp() { $this->mock->register(); } + /** + * Confirm that User Switching is installed and active. + */ + public function test_user_switching_installed_and_activated() { + $this->assertTrue( class_exists( 'user_switching' ) ); + } + public function test_callback_switch_to_user() { + // Create and authenticate user to be switched from. + $old_user_id = self::factory()->user->create( + array( + 'user_login' => 'oldtestuser', + 'user_role' => 'adminstrator', + 'display_name' => 'oldtestuserdisplay', + ) + ); + wp_set_current_user( $old_user_id ); + + // Create user ID for destination user. + $user_id = self::factory()->user->create( + array( + 'user_login' => 'testuser', + 'user_role' => 'adminstrator', + 'display_name' => 'testuserdisplay', + ) + ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + 'Switched user to %1$s (%2$s)', + '1: User display name, 2: User login', + 'stream' + ) + ), + $this->equalTo( + array( + 'display_name' => 'testuserdisplay', + 'user_login' => 'testuser', + ) + ), + $this->equalTo( $old_user_id ), + $this->equalTo( 'sessions' ), + $this->equalTo( 'switched-to' ), + $this->equalTo( $old_user_id ) + ); + // Switch to user to trigger callback. + \switch_to_user( $user_id ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_switch_to_user' ) ); } public function test_callback_switch_back_user() { + // Create and authenticate users for later use. + $old_user_id = self::factory()->user->create( + array( + 'user_login' => 'oldtestuser', + 'user_role' => 'adminstrator', + 'display_name' => 'oldtestuserdisplay', + ) + ); + $user_id = self::factory()->user->create( + array( + 'user_login' => 'testuser', + 'user_role' => 'adminstrator', + 'display_name' => 'testuserdisplay', + ) + ); + + wp_set_current_user( $old_user_id ); + \switch_to_user( $user_id ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + 'Switched back to %1$s (%2$s)', + '1: User display name, 2: User login', + 'stream' + ) + ), + $this->equalTo( + array( + 'display_name' => 'oldtestuserdisplay', + 'user_login' => 'oldtestuser', + ) + ), + $this->equalTo( $user_id ), + $this->equalTo( 'sessions' ), + $this->equalTo( 'switched-back' ), + $this->equalTo( $user_id ) + ); + // Switch to user to trigger callback. + \switch_to_user( $old_user_id, false, false ); + + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_switch_back_user' ) ); } public function test_callback_switch_off_user() { + // Create/authenticate user for later use. + $user_id = self::factory()->user->create( + array( + 'user_login' => 'testuser', + 'user_role' => 'adminstrator', + 'display_name' => 'testuserdisplay', + ) + ); + wp_set_current_user( $user_id ); - } + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( __( 'Switched off', 'stream' ) ), + $this->equalTo( array() ), + $this->equalTo( $user_id ), + $this->equalTo( 'sessions' ), + $this->equalTo( 'switched-off' ), + $this->equalTo( $user_id ) + ); - public function test_callback_wp_stream_after_connectors_registration() { + // Switch to user to trigger callback. + \switch_off_user(); + // Check callback test action. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_switch_off_user' ) ); } } From b540f51a530f82e2586d7b16180fd5024bc5b826 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 12 Sep 2020 19:01:37 +0000 Subject: [PATCH 11/25] Update dependency eslint to ^7.9.0 --- package-lock.json | 26 ++++++++++++-------------- package.json | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 742568348..49eab9831 100644 --- a/package-lock.json +++ b/package-lock.json @@ -281,14 +281,6 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" - }, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - } } }, "@wordpress/prettier-config": { @@ -310,9 +302,9 @@ "dev": true }, "acorn-jsx": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", - "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", "dev": true }, "ajv": { @@ -1150,9 +1142,9 @@ "dev": true }, "eslint": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.8.1.tgz", - "integrity": "sha512-/2rX2pfhyUG0y+A123d0ccXtMm7DV7sH1m3lk9nk2DZ2LReq39FXHueR9xZwshE5MdfSf0xunSaMWRqyIA6M1w==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz", + "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -3420,6 +3412,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/package.json b/package.json index f84980f3d..8d2654530 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "@wordpress/eslint-plugin": "^7.1.0", - "eslint": "^7.8.1", + "eslint": "^7.9.0", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", From 5c83c51b04910334e4054bbc267861808e92cc68 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 29 Jun 2020 21:17:52 -0400 Subject: [PATCH 12/25] posts-connector test updated --- .../connectors/test-class-connector-posts.php | 122 +++++++++++++++++- 1 file changed, 119 insertions(+), 3 deletions(-) diff --git a/tests/tests/connectors/test-class-connector-posts.php b/tests/tests/connectors/test-class-connector-posts.php index bc9fab027..e853a2ffe 100644 --- a/tests/tests/connectors/test-class-connector-posts.php +++ b/tests/tests/connectors/test-class-connector-posts.php @@ -2,11 +2,127 @@ namespace WP_Stream; class Test_WP_Stream_Connector_Posts extends WP_StreamTestCase { + /** + * Holds local timestamp in "Y-m-d H:i:s" format + * + * @var string + */ + private $date; - public function test_reminder() { - $this->markTestIncomplete( - 'Not implemented yet.' + /** + * Holds GMT timestamp in "Y-m-d H:i:s" format + * + * @var string + */ + private $date_gmt; + + /** + * Runs before each test. + */ + public function setUp() { + parent::setUp(); + + $this->plugin->connectors->unload_connectors(); + + // Set static timestamps. + $this->date = '2007-07-04 12:30:00'; + $this->date_gmt = get_gmt_from_date( $this->date ); + + // Make partial of Connector_Posts class, with mocked "log" function. + $this->mock = $this->getMockBuilder( Connector_Posts::class ) + ->setMethods( [ 'log' ] ) + ->getMock(); + + // Register connector. + $this->mock->register(); + } + + /** + * Tests "transition_post_status" callback function. + */ + public function test_callback_transition_post_status() { + // Set expected calls for the Mock. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + '"%1$s" %2$s updated', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->equalTo( + array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'post_date' => $this->date, + 'post_date_gmt' => $this->date_gmt, + 'new_status' => 'publish', + 'old_status' => 'new', + 'revision_id' => null, + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ) + ); + + // Create post and trigger mock. + wp_insert_post( + array( + 'post_title' => 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_date' => $this->date, + 'post_date_gmt' => $this->date_gmt, + 'post_status' => 'publish' + ) ); + + // Confirm callback execution. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_transition_post_status' ) ); + } + + /** + * Tests "deleted_post" callback function. + */ + public function test_callback_deleted_post() { + // Create post for later use. + $post_id = wp_insert_post( + array( + 'post_title' => 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_status' => 'publish' + ) + ); + + // Set expected calls for the Mock. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + '"%1$s" %2$s deleted from trash', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->equalTo( + array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'deleted' ) + ); + + // Delete post and trigger mock. + wp_delete_post( $post_id, true ); + + // Confirm callback execution. + $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_deleted_post' ) ); } } From c1622e9435306a0b8de9836c565eb9ccdab8c1f9 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 17 Sep 2020 14:15:33 -0400 Subject: [PATCH 13/25] Post connector tests expanded. --- composer.lock | 247 +++++++---- .../connectors/test-class-connector-posts.php | 395 ++++++++++++++++-- 2 files changed, 536 insertions(+), 106 deletions(-) diff --git a/composer.lock b/composer.lock index d45b1aa6d..c3bdcb931 100644 --- a/composer.lock +++ b/composer.lock @@ -137,20 +137,21 @@ "packages-dev": [ { "name": "automattic/vipwpcs", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "03e75ddd0261b675dece60fb67fc2e9c6af4ad35" + "reference": "4d0612461232b313d06321f1501c3989bd6aecf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/03e75ddd0261b675dece60fb67fc2e9c6af4ad35", - "reference": "03e75ddd0261b675dece60fb67fc2e9c6af4ad35", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/4d0612461232b313d06321f1501c3989bd6aecf9", + "reference": "4d0612461232b313d06321f1501c3989bd6aecf9", "shasum": "" }, "require": { "php": ">=5.4", + "sirbrillig/phpcs-variable-analysis": "^2.8.3", "squizlabs/php_codesniffer": "^3.5.5", "wp-coding-standards/wpcs": "^2.3" }, @@ -179,20 +180,20 @@ "standards", "wordpress" ], - "time": "2020-07-07T07:48:04+00:00" + "time": "2020-09-07T10:45:45+00:00" }, { "name": "composer/ca-bundle", - "version": "1.2.7", + "version": "1.2.8", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" + "reference": "8a7ecad675253e4654ea05505233285377405215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215", + "reference": "8a7ecad675253e4654ea05505233285377405215", "shasum": "" }, "require": { @@ -235,20 +236,34 @@ "ssl", "tls" ], - "time": "2020-04-08T08:27:21+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-23T12:54:47+00:00" }, { "name": "composer/composer", - "version": "1.10.10", + "version": "1.10.13", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "32966a3b1d48bc01472a8321fd6472b44fad033a" + "reference": "47c841ba3b2d3fc0b4b13282cf029ea18b66d78b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/32966a3b1d48bc01472a8321fd6472b44fad033a", - "reference": "32966a3b1d48bc01472a8321fd6472b44fad033a", + "url": "https://api.github.com/repos/composer/composer/zipball/47c841ba3b2d3fc0b4b13282cf029ea18b66d78b", + "reference": "47c841ba3b2d3fc0b4b13282cf029ea18b66d78b", "shasum": "" }, "require": { @@ -329,20 +344,20 @@ "type": "tidelift" } ], - "time": "2020-08-03T09:35:19+00:00" + "time": "2020-09-09T09:46:34+00:00" }, { "name": "composer/semver", - "version": "1.5.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + "reference": "114f819054a2ea7db03287f5efb757e2af6e4079" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "url": "https://api.github.com/repos/composer/semver/zipball/114f819054a2ea7db03287f5efb757e2af6e4079", + "reference": "114f819054a2ea7db03287f5efb757e2af6e4079", "shasum": "" }, "require": { @@ -390,7 +405,21 @@ "validation", "versioning" ], - "time": "2020-01-13T12:06:48+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-09-09T09:34:06+00:00" }, { "name": "composer/spdx-licenses", @@ -468,16 +497,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ebd27a9866ae8254e873866f795491f02418c5a5", + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5", "shasum": "" }, "require": { @@ -508,7 +537,21 @@ "Xdebug", "performance" ], - "time": "2020-06-04T11:16:35+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-19T10:27:58+00:00" }, { "name": "cweagans/composer-patches", @@ -922,20 +965,20 @@ }, { "name": "johnpbloch/wordpress", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress.git", - "reference": "d8a952dd4aa7f7d4d8be6fa145840fde4e248450" + "reference": "0973abd5c01ecce0b60bc1c81a6dd072827de930" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/d8a952dd4aa7f7d4d8be6fa145840fde4e248450", - "reference": "d8a952dd4aa7f7d4d8be6fa145840fde4e248450", + "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/0973abd5c01ecce0b60bc1c81a6dd072827de930", + "reference": "0973abd5c01ecce0b60bc1c81a6dd072827de930", "shasum": "" }, "require": { - "johnpbloch/wordpress-core": "5.5.0", + "johnpbloch/wordpress-core": "5.5.1", "johnpbloch/wordpress-core-installer": "^1.0 || ^2.0", "php": ">=5.6.20" }, @@ -957,20 +1000,20 @@ "cms", "wordpress" ], - "time": "2020-08-11T18:47:19+00:00" + "time": "2020-09-01T19:07:41+00:00" }, { "name": "johnpbloch/wordpress-core", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "c49d46de4e4c8972b8ed2aebe3e850f4f218186f" + "reference": "fa5bcb1579eae33baef6c04355f8d6657e5bd349" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/c49d46de4e4c8972b8ed2aebe3e850f4f218186f", - "reference": "c49d46de4e4c8972b8ed2aebe3e850f4f218186f", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/fa5bcb1579eae33baef6c04355f8d6657e5bd349", + "reference": "fa5bcb1579eae33baef6c04355f8d6657e5bd349", "shasum": "" }, "require": { @@ -978,7 +1021,7 @@ "php": ">=5.6.20" }, "provide": { - "wordpress/core-implementation": "5.5.0" + "wordpress/core-implementation": "5.5.1" }, "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", @@ -998,7 +1041,7 @@ "cms", "wordpress" ], - "time": "2020-08-11T18:47:13+00:00" + "time": "2020-09-01T19:07:35+00:00" }, { "name": "johnpbloch/wordpress-core-installer", @@ -2727,16 +2770,16 @@ }, { "name": "seld/jsonlint", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd" + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/3d5eb71705adfa34bd34b993400622932b2f62fd", - "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/590cfec960b77fd55e39b7d9246659e95dd6d337", + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337", "shasum": "" }, "require": { @@ -2782,7 +2825,7 @@ "type": "tidelift" } ], - "time": "2020-08-13T09:07:59+00:00" + "time": "2020-08-25T06:56:57+00:00" }, { "name": "seld/phar-utils", @@ -2828,6 +2871,54 @@ ], "time": "2020-07-07T18:42:57+00:00" }, + { + "name": "sirbrillig/phpcs-variable-analysis", + "version": "v2.8.3", + "source": { + "type": "git", + "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", + "reference": "00b4fa3130faa26762c929989e3d958086c627f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/00b4fa3130faa26762c929989e3d958086c627f1", + "reference": "00b4fa3130faa26762c929989e3d958086c627f1", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "squizlabs/php_codesniffer": "^3.1" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || ^0.5 || ^0.6", + "limedeck/phpunit-detailed-printer": "^3.1 || ^4.0 || ^5.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^5.0 || ^6.5 || ^7.0 || ^8.0", + "sirbrillig/phpcs-import-detection": "^1.1" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "VariableAnalysis\\": "VariableAnalysis/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Sam Graham", + "email": "php-codesniffer-variableanalysis@illusori.co.uk" + }, + { + "name": "Payton Swick", + "email": "payton@foolord.com" + } + ], + "description": "A PHPCS sniff to detect problems with variables.", + "time": "2020-07-11T23:32:06+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.5.6", @@ -2881,16 +2972,16 @@ }, { "name": "symfony/config", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "9e2aa97f0d51f114983666f5aa362426d53e004a" + "reference": "801a3bbc17fb1ba44b0d7d41a6db7a0b74953595" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9e2aa97f0d51f114983666f5aa362426d53e004a", - "reference": "9e2aa97f0d51f114983666f5aa362426d53e004a", + "url": "https://api.github.com/repos/symfony/config/zipball/801a3bbc17fb1ba44b0d7d41a6db7a0b74953595", + "reference": "801a3bbc17fb1ba44b0d7d41a6db7a0b74953595", "shasum": "" }, "require": { @@ -2955,20 +3046,20 @@ "type": "tidelift" } ], - "time": "2020-07-23T09:37:51+00:00" + "time": "2020-08-10T07:13:15+00:00" }, { "name": "symfony/console", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "afc7189694d2c59546cf24ea606a236fa46a966e" + "reference": "71da881ad579f0cd66aef8677e4cf6217d8ecd0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/afc7189694d2c59546cf24ea606a236fa46a966e", - "reference": "afc7189694d2c59546cf24ea606a236fa46a966e", + "url": "https://api.github.com/repos/symfony/console/zipball/71da881ad579f0cd66aef8677e4cf6217d8ecd0c", + "reference": "71da881ad579f0cd66aef8677e4cf6217d8ecd0c", "shasum": "" }, "require": { @@ -3041,20 +3132,20 @@ "type": "tidelift" } ], - "time": "2020-07-06T08:57:31+00:00" + "time": "2020-08-09T08:16:57+00:00" }, { "name": "symfony/debug", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "7ce874f4432d8b11cc45a80cc5130a6e2609728d" + "reference": "0893a0b07c499a1530614d65869ea6a7b1b8a164" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/7ce874f4432d8b11cc45a80cc5130a6e2609728d", - "reference": "7ce874f4432d8b11cc45a80cc5130a6e2609728d", + "url": "https://api.github.com/repos/symfony/debug/zipball/0893a0b07c499a1530614d65869ea6a7b1b8a164", + "reference": "0893a0b07c499a1530614d65869ea6a7b1b8a164", "shasum": "" }, "require": { @@ -3111,20 +3202,20 @@ "type": "tidelift" } ], - "time": "2020-07-16T09:41:49+00:00" + "time": "2020-08-09T08:13:48+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "0f625d0cb1e59c8c4ba61abb170125175218ff10" + "reference": "8e6eff546d0fe879996fa701ee2f312767e95e50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f625d0cb1e59c8c4ba61abb170125175218ff10", - "reference": "0f625d0cb1e59c8c4ba61abb170125175218ff10", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8e6eff546d0fe879996fa701ee2f312767e95e50", + "reference": "8e6eff546d0fe879996fa701ee2f312767e95e50", "shasum": "" }, "require": { @@ -3175,11 +3266,11 @@ "type": "tidelift" } ], - "time": "2020-05-30T17:48:24+00:00" + "time": "2020-08-21T12:53:49+00:00" }, { "name": "symfony/finder", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3711,7 +3802,7 @@ }, { "name": "symfony/process", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -3774,7 +3865,7 @@ }, { "name": "symfony/stopwatch", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -3837,16 +3928,16 @@ }, { "name": "symfony/yaml", - "version": "v3.4.43", + "version": "v3.4.44", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e7fa05917ae931332a42d65b577ece4d497aad81" + "reference": "4152e36b0f305c2a57aa0233dee56ec27bca4f06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e7fa05917ae931332a42d65b577ece4d497aad81", - "reference": "e7fa05917ae931332a42d65b577ece4d497aad81", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4152e36b0f305c2a57aa0233dee56ec27bca4f06", + "reference": "4152e36b0f305c2a57aa0233dee56ec27bca4f06", "shasum": "" }, "require": { @@ -3906,7 +3997,7 @@ "type": "tidelift" } ], - "time": "2020-07-23T09:37:51+00:00" + "time": "2020-08-26T06:32:27+00:00" }, { "name": "webmozart/assert", @@ -5971,16 +6062,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "5cf5a40954b8c47941afdc08b0000ce42efe5993" + "reference": "763121e752594664c150643e05c991a0acf3800a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/5cf5a40954b8c47941afdc08b0000ce42efe5993", - "reference": "5cf5a40954b8c47941afdc08b0000ce42efe5993", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/763121e752594664c150643e05c991a0acf3800a", + "reference": "763121e752594664c150643e05c991a0acf3800a", "shasum": "" }, "type": "library", @@ -6010,7 +6101,7 @@ "test", "wordpress" ], - "time": "2020-08-12T15:43:21+00:00" + "time": "2020-09-02T15:53:50+00:00" }, { "name": "wpackagist-plugin/advanced-custom-fields", @@ -6032,15 +6123,15 @@ }, { "name": "wpackagist-plugin/easy-digital-downloads", - "version": "2.9.23", + "version": "2.9.25", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/easy-digital-downloads/", - "reference": "tags/2.9.23" + "reference": "tags/2.9.25" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.23.zip" + "url": "https://downloads.wordpress.org/plugin/easy-digital-downloads.2.9.25.zip" }, "require": { "composer/installers": "~1.0" diff --git a/tests/tests/connectors/test-class-connector-posts.php b/tests/tests/connectors/test-class-connector-posts.php index e853a2ffe..8756b6437 100644 --- a/tests/tests/connectors/test-class-connector-posts.php +++ b/tests/tests/connectors/test-class-connector-posts.php @@ -1,4 +1,9 @@ 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_date' => $this->date, + 'post_date_gmt' => $this->date_gmt, + 'post_status' => 'draft' + ); + // Set expected calls for the Mock. - $this->mock->expects( $this->once() ) + $this->mock->expects( $this->exactly( 11 ) ) ->method( 'log' ) - ->with( - $this->equalTo( - _x( - '"%1$s" %2$s updated', - '1: Post title, 2: Post type singular name', - 'stream' - ) + ->withConsecutive( + array( + $this->equalTo( + _x( + '"%1$s" %2$s drafted', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'draft', + 'old_status' => 'new', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), ), - $this->equalTo( - array( - 'post_title' => 'Test post', - 'singular_name' => 'post', - 'post_date' => $this->date, - 'post_date_gmt' => $this->date_gmt, - 'new_status' => 'publish', - 'old_status' => 'new', - 'revision_id' => null, - ) + array( + $this->equalTo( + _x( + '"%1$s" %2$s published', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'publish', + 'old_status' => 'draft', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), ), - $this->greaterThan( 0 ), - $this->equalTo( 'post' ), - $this->equalTo( 'updated' ) + array( + $this->equalTo( + _x( + '"%1$s" %2$s unpublished', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'draft', + 'old_status' => 'publish', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s draft saved', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'draft', + 'old_status' => 'draft', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s pending review', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'pending', + 'old_status' => 'draft', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s scheduled for %3$s', + '1: Post title, 2: Post type singular name, 3: Scheduled post date', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'future', + 'old_status' => 'pending', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" scheduled %2$s published', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'publish', + 'old_status' => 'future', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s privately published', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'private', + 'old_status' => 'publish', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s trashed', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'trash', + 'old_status' => 'private', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'trashed' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s restored from trash', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'publish', + 'old_status' => 'trash', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'untrashed' ), + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s updated', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'publish', + 'old_status' => 'publish', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ), + ) ); - // Create post and trigger mock. + // Create post/update post status trigger callbacks. + $post_id = wp_insert_post( $post_args ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'publish', + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'draft', + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'draft', + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'pending', + ) + ); + $time = strtotime( 'tomorrow' ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'future', + 'post_date' => date( 'Y-m-d H:i:s', $time ), + 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $time ), + ) + ); + $time = strtotime( 'now' ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'publish', + 'post_date' => date( 'Y-m-d H:i:s', $time ), + 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $time ), + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'private', + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'trash', + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'publish', + ) + ); + wp_update_post( + array( + 'ID' => $post_id, + 'post_status' => 'publish', + ) + ); + + /** + * Expected log to not be called for newly published attachment + * because it's an excluded post type. + */ wp_insert_post( array( - 'post_title' => 'Test post', + 'post_title' => 'Test attachment', 'post_content' => 'Lorem ipsum dolor...', - 'post_date' => $this->date, - 'post_date_gmt' => $this->date_gmt, - 'post_status' => 'publish' + 'post_status' => 'publish', + 'post_type' => 'attachment', ) ); + // Confirm callback execution. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_transition_post_status' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_transition_post_status' ) ); } /** @@ -96,6 +414,22 @@ public function test_callback_deleted_post() { ) ); + $auto_draft_post_id = wp_insert_post( + array( + 'post_title' => 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_status' => 'auto-draft' + ) + ); + + $attachment_post_id = wp_insert_post( + array( + 'post_title' => 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_type' => 'attachment' + ) + ); + // Set expected calls for the Mock. $this->mock->expects( $this->once() ) ->method( 'log' ) @@ -121,8 +455,13 @@ public function test_callback_deleted_post() { // Delete post and trigger mock. wp_delete_post( $post_id, true ); + // Delete auto-drafted post and attachment to confirm these actions is ignored. + wp_delete_post( $auto_draft_post_id, true ); + wp_delete_post( $attachment_post_id, true ); + + // Confirm callback execution. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_deleted_post' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_deleted_post' ) ); } } From 9ea306478c32aab13754af63488f0ae6803c2534 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Aug 2020 15:42:52 -0400 Subject: [PATCH 14/25] WHERE statement filter added. --- classes/class-query.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/classes/class-query.php b/classes/class-query.php index 6a612fe9f..c59206227 100644 --- a/classes/class-query.php +++ b/classes/class-query.php @@ -216,6 +216,16 @@ public function query( $args ) { $select = implode( ', ', $selects ); + /** + * Filters query WHERE statement as an alternative to filtering + * the $query using the hook below. + * + * @param string $where WHERE statement. + * + * @return string + */ + $where = apply_filters( 'wp_stream_db_query', $where ); + /** * BUILD THE FINAL QUERY */ From 0d9bc09c8a6e667c62157e2a2ae1ff41aeed30fd Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 17 Sep 2020 15:26:05 -0400 Subject: [PATCH 15/25] hook name changed. --- classes/class-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-query.php b/classes/class-query.php index c59206227..92ddcfe07 100644 --- a/classes/class-query.php +++ b/classes/class-query.php @@ -224,7 +224,7 @@ public function query( $args ) { * * @return string */ - $where = apply_filters( 'wp_stream_db_query', $where ); + $where = apply_filters( 'wp_stream_db_query_where', $where ); /** * BUILD THE FINAL QUERY From eb25c8d8ee523b098a2375c44a43373e36bac3da Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 18 Sep 2020 03:18:53 +0000 Subject: [PATCH 16/25] Update dependency @wordpress/eslint-plugin to ^7.2.1 --- package-lock.json | 332 ++++++++++++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 231 insertions(+), 103 deletions(-) diff --git a/package-lock.json b/package-lock.json index 49eab9831..001d9e597 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,14 +13,13 @@ } }, "@babel/generator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.4.tgz", - "integrity": "sha512-toLIHUIAgcQygFZRAQcsLQV3CBuX6yOIru1kJk/qqqvcRmZrYe6WavZTSG+bB8MxhnL9YPf+pKQfuiP161q7ng==", + "version": "7.11.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.6.tgz", + "integrity": "sha512-DWtQ1PV3r+cLbySoHrwn9RWEgKMBLLma4OBQloPRyDYvc5msJM9kvTLo1YnlJd1P/ZuKbdli3ijr5q3FvAF3uA==", "dev": true, "requires": { - "@babel/types": "^7.10.4", + "@babel/types": "^7.11.5", "jsesc": "^2.5.1", - "lodash": "^4.17.13", "source-map": "^0.5.0" } }, @@ -45,12 +44,12 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz", - "integrity": "sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", + "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.11.0" } }, "@babel/helper-validator-identifier": { @@ -71,24 +70,24 @@ } }, "@babel/parser": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.4.tgz", - "integrity": "sha512-8jHII4hf+YVDsskTF6WuMB3X4Eh+PsUkC2ljq22so5rHvH+T8BzyL94VOdyFLNR8tBSVXOTbNHOKpR4TfRxVtA==", + "version": "7.11.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.5.tgz", + "integrity": "sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==", "dev": true }, "@babel/runtime": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.4.tgz", - "integrity": "sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", + "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", "dev": true, "requires": { "regenerator-runtime": "^0.13.4" } }, "@babel/runtime-corejs3": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.10.4.tgz", - "integrity": "sha512-BFlgP2SoLO9HJX9WBwN67gHWMBhDX/eDz64Jajd6mR/UAUzqrNMm99d4qHnVaKscAElZoFiPv+JpR/Siud5lXw==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.11.2.tgz", + "integrity": "sha512-qh5IR+8VgFz83VBa6OkaET6uN/mJOhHONuy3m1sgF0CV6mXdPSEBdA7e1eUbVvyNtANjMbg22JUv71BaDXLY6A==", "dev": true, "requires": { "core-js-pure": "^3.0.0", @@ -129,20 +128,20 @@ } }, "@babel/traverse": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.4.tgz", - "integrity": "sha512-aSy7p5THgSYm4YyxNGz6jZpXf+Ok40QF3aA2LyIONkDHpAcJzDUqlCKXv6peqYUs2gmic849C/t2HKw2a2K20Q==", + "version": "7.11.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.5.tgz", + "integrity": "sha512-EjiPXt+r7LiCZXEfRpSJd+jUMnBd4/9OUv7Nx3+0u9+eimMwJmG0Q98lw4/289JCoxSE8OolDMNZaaF/JZ69WQ==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.10.4", + "@babel/generator": "^7.11.5", "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4", + "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/parser": "^7.11.5", + "@babel/types": "^7.11.5", "debug": "^4.1.0", "globals": "^11.1.0", - "lodash": "^4.17.13" + "lodash": "^4.17.19" }, "dependencies": { "@babel/code-frame": { @@ -174,13 +173,13 @@ } }, "@babel/types": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.4.tgz", - "integrity": "sha512-UTCFOxC3FsFHb7lkRMVvgLzaRVamXuAs2Tz4wajva4WxtVY82eZeaUBtC2Zt95FU9TiznuC0Zk35tsim8jeVpg==", + "version": "7.11.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", + "integrity": "sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.13", + "lodash": "^4.17.19", "to-fast-properties": "^2.0.0" } }, @@ -209,9 +208,15 @@ "dev": true }, "@types/json-schema": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", - "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", + "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, "@typescript-eslint/experimental-utils": { @@ -264,16 +269,17 @@ } }, "@wordpress/eslint-plugin": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-7.1.0.tgz", - "integrity": "sha512-FTrKkpEa8vZg7/7M6GBhd1YW24hnh5rFGzKgKX4MGyB0Jw8GGSwld9J23eRbQ5JQWGFP/tmOMeiu6W1/arxy7Q==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-7.2.1.tgz", + "integrity": "sha512-p4LrUukVyuZAH/vSHFOV5L0NHW2i8WegOYFDgYCIzcWCi/A7jW1O+vUA5ylm1rRCKqj8Z/4WIMOGflf/8delYw==", "dev": true, "requires": { - "@wordpress/prettier-config": "^0.3.0", + "@wordpress/prettier-config": "^0.4.0", "babel-eslint": "^10.1.0", + "cosmiconfig": "^7.0.0", "eslint-config-prettier": "^6.10.1", "eslint-plugin-jest": "^23.8.2", - "eslint-plugin-jsdoc": "^26.0.0", + "eslint-plugin-jsdoc": "^30.2.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.20.0", @@ -281,12 +287,20 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" + }, + "dependencies": { + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + } } }, "@wordpress/prettier-config": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-0.3.0.tgz", - "integrity": "sha512-wL1ztV+so5Ttwz23lDmb8ZmREmND96sf+Dh/kbP2nyAw/DWt3K8uj31qbczVmjwfoetTiRoH9Z1CasgPs4bccg==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-0.4.0.tgz", + "integrity": "sha512-7c4VeugkCwDkaHSD7ffxoP0VC5c///gCTEAT032OhI5Rik2dPxE3EkNAB2NhotGE8M4dMAg4g5Wj2OWZIn8TFw==", "dev": true }, "abbrev": { @@ -851,9 +865,9 @@ "dev": true }, "comment-parser": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.5.tgz", - "integrity": "sha512-iH9YA35ccw94nx5244GVkpyC9eVTsL71jZz6iz5w6RIf79JLF2AsXHXq9p6Oaohyl3sx5qSMnGsWUDFIAfWL4w==", + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.6.tgz", + "integrity": "sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg==", "dev": true }, "component-emitter": { @@ -905,6 +919,19 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, + "cosmiconfig": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", + "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, "crc": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", @@ -1105,6 +1132,15 @@ "ansi-colors": "^4.1.1" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "es-abstract": { "version": "1.17.6", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", @@ -1293,33 +1329,39 @@ } }, "eslint-plugin-jest": { - "version": "23.18.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.18.0.tgz", - "integrity": "sha512-wLPM/Rm1SGhxrFQ2TKM/BYsYPhn7ch6ZEK92S2o/vGkAAnDXM0I4nTIo745RIX+VlCRMFgBuJEax6XfTHMdeKg==", + "version": "23.20.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.20.0.tgz", + "integrity": "sha512-+6BGQt85OREevBDWCvhqj1yYA4+BFK4XnRZSGJionuEYmcglMZYLNNBBemwzbqUAckURaHdJSBcjHPyrtypZOw==", "dev": true, "requires": { "@typescript-eslint/experimental-utils": "^2.5.0" } }, "eslint-plugin-jsdoc": { - "version": "26.0.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-26.0.2.tgz", - "integrity": "sha512-KtZjqtM3Z8x84vQBFKGUyBbZRGXYHVWSJ2XyYSUTc8KhfFrvzQ/GXPp6f1M1/YCNzP3ImD5RuDNcr+OVvIZcBA==", + "version": "30.5.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.5.1.tgz", + "integrity": "sha512-cY3YNxdhFcQVkcQLnZw/iZGsTPMuWa9yWZclorMWkjdHprBQX0TMWMEcmJYM3IjHp1HJr7aD0Z0sCRifEBhnzg==", "dev": true, "requires": { - "comment-parser": "^0.7.4", + "comment-parser": "^0.7.6", "debug": "^4.1.1", - "jsdoctypeparser": "^6.1.0", - "lodash": "^4.17.15", + "jsdoctypeparser": "^9.0.0", + "lodash": "^4.17.20", "regextras": "^0.7.1", - "semver": "^6.3.0", + "semver": "^7.3.2", "spdx-expression-parse": "^3.0.1" }, "dependencies": { + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true } } @@ -1361,9 +1403,9 @@ } }, "eslint-plugin-react": { - "version": "7.20.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.20.3.tgz", - "integrity": "sha512-txbo090buDeyV0ugF3YMWrzLIUqpYTsWSDZV9xLSmExE1P/Kmgg9++PD931r+KEWS66O1c9R4srLVVHmeHpoAg==", + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.20.6.tgz", + "integrity": "sha512-kidMTE5HAEBSLu23CUDvj8dc3LdBU0ri1scwHBZjI41oDv4tjsWZKU7MQccFzH1QYPYhsnTF2ovh7JlcIcmxgg==", "dev": true, "requires": { "array-includes": "^3.1.1", @@ -1380,9 +1422,9 @@ } }, "eslint-plugin-react-hooks": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.5.tgz", - "integrity": "sha512-3YLSjoArsE2rUwL8li4Yxx1SUg3DQWp+78N3bcJQGWVZckcp+yeQGsap/MSq05+thJk57o+Ww4PtZukXGL02TQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.1.2.tgz", + "integrity": "sha512-ykUeqkGyUGgwTtk78C0o8UG2fzwmgJ0qxBGPp2WqRKsTwcLuVf01kTDRAtOsd4u6whX2XOC8749n2vPydP82fg==", "dev": true }, "eslint-scope": { @@ -1396,18 +1438,18 @@ } }, "eslint-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", - "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" } }, "eslint-visitor-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true }, "espree": { @@ -2535,6 +2577,12 @@ } } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -2542,9 +2590,9 @@ "dev": true }, "is-callable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", - "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.1.tgz", + "integrity": "sha512-wliAfSzx6V+6WfMOmus1xy0XvSgf/dlStkvTfq7F0g4bOIW0PSUbnyse3NhDwdyYS1ozfUtAAySqTws3z9Eqgg==", "dev": true }, "is-data-descriptor": { @@ -2619,6 +2667,12 @@ "is-extglob": "^2.1.1" } }, + "is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -2649,9 +2703,9 @@ } }, "is-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", - "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", "dev": true, "requires": { "has-symbols": "^1.0.1" @@ -2731,9 +2785,9 @@ } }, "jsdoctypeparser": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-6.1.0.tgz", - "integrity": "sha512-UCQBZ3xCUBv/PLfwKAJhp6jmGOSLFNKzrotXGNgbKhWvz27wPsCsVeP7gIcHPElQw2agBmynAitXqhxR58XAmA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz", + "integrity": "sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==", "dev": true }, "jsesc": { @@ -2742,6 +2796,12 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -2843,6 +2903,12 @@ } } }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", @@ -3171,15 +3237,37 @@ } }, "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz", + "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.0", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + } } }, "object.defaults": { @@ -3322,6 +3410,18 @@ "path-root": "^0.1.1" } }, + "parse-json": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", + "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, "parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", @@ -3367,6 +3467,12 @@ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -3412,12 +3518,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", @@ -3536,9 +3636,9 @@ } }, "regenerator-runtime": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", - "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", "dev": true }, "regex-not": { @@ -3742,13 +3842,35 @@ "dev": true }, "side-channel": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.2.tgz", - "integrity": "sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", + "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==", "dev": true, "requires": { - "es-abstract": "^1.17.0-next.1", - "object-inspect": "^1.7.0" + "es-abstract": "^1.18.0-next.0", + "object-inspect": "^1.8.0" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz", + "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.0", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + } } }, "signal-exit": { @@ -3962,9 +4084,9 @@ } }, "spdx-license-ids": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", + "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", "dev": true }, "split-string": { @@ -4504,6 +4626,12 @@ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, + "yaml": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", + "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", + "dev": true + }, "zip-stream": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", diff --git a/package.json b/package.json index 8d2654530..0d01cb815 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "track" ], "devDependencies": { - "@wordpress/eslint-plugin": "^7.1.0", + "@wordpress/eslint-plugin": "^7.2.1", "eslint": "^7.9.0", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", From 8801591877860139f099650e9c4e16ead3c1c541 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 24 Sep 2020 11:14:33 -0400 Subject: [PATCH 17/25] Post connector updated to account for "new" status --- connectors/class-connector-posts.php | 7 ++-- .../connectors/test-class-connector-posts.php | 38 +++++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/connectors/class-connector-posts.php b/connectors/class-connector-posts.php index ce74a4226..dd6893b1d 100644 --- a/connectors/class-connector-posts.php +++ b/connectors/class-connector-posts.php @@ -170,7 +170,8 @@ public function callback_transition_post_status( $new, $old, $post ) { return; } - if ( in_array( $new, array( 'auto-draft', 'inherit' ), true ) ) { + $start_statuses = array( 'auto-draft', 'inherit', 'new' ); + if ( in_array( $new, $start_statuses, true ) ) { return; } elseif ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; @@ -196,7 +197,7 @@ public function callback_transition_post_status( $new, $old, $post ) { '1: Post title, 2: Post type singular name', 'stream' ); - } elseif ( 'publish' === $new && 'draft' === $old ) { + } elseif ( 'publish' === $new && ! in_array( $old, array( 'future', 'publish' ), true ) ) { /* translators: %1$s: a post title, %2$s: a post type singular name (e.g. "Hello World", "Post") */ $summary = _x( '"%1$s" %2$s published', @@ -255,7 +256,7 @@ public function callback_transition_post_status( $new, $old, $post ) { ); } - if ( 'auto-draft' === $old && 'auto-draft' !== $new ) { + if ( in_array( $old, $start_statuses, true ) && ! in_array( $new, $start_statuses, true ) ) { $action = 'created'; } diff --git a/tests/tests/connectors/test-class-connector-posts.php b/tests/tests/connectors/test-class-connector-posts.php index 8756b6437..149637e31 100644 --- a/tests/tests/connectors/test-class-connector-posts.php +++ b/tests/tests/connectors/test-class-connector-posts.php @@ -56,7 +56,7 @@ public function test_callback_transition_post_status() { ); // Set expected calls for the Mock. - $this->mock->expects( $this->exactly( 11 ) ) + $this->mock->expects( $this->exactly( 12 ) ) ->method( 'log' ) ->withConsecutive( array( @@ -80,7 +80,7 @@ function( $subject ) { ), $this->greaterThan( 0 ), $this->equalTo( 'post' ), - $this->equalTo( 'updated' ), + $this->equalTo( 'created' ), ), array( $this->equalTo( @@ -311,7 +311,30 @@ function( $subject ) { $this->greaterThan( 0 ), $this->equalTo( 'post' ), $this->equalTo( 'updated' ), - ) + ), + array( + $this->equalTo( + _x( + '"%1$s" %2$s published', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->callback( + function( $subject ) { + $expected = array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + 'new_status' => 'publish', + 'old_status' => 'new', + ); + return $expected === array_intersect_key( $expected, $subject ); + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'created' ), + ), ); // Create post/update post status trigger callbacks. @@ -383,6 +406,15 @@ function( $subject ) { ) ); + // Expected log to be made with "created" action. + wp_insert_post( + array( + 'post_title' => 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_status' => 'publish', + ) + ); + /** * Expected log to not be called for newly published attachment * because it's an excluded post type. From 08b1298f2313099215198ae566ad679f72d63013 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 26 Sep 2020 22:08:40 +0000 Subject: [PATCH 18/25] Update dependency eslint to ^7.10.0 --- package-lock.json | 68 ++++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index 001d9e597..b201376ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -287,14 +287,6 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" - }, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - } } }, "@wordpress/prettier-config": { @@ -322,9 +314,9 @@ "dev": true }, "ajv": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz", - "integrity": "sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==", + "version": "6.12.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", + "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -1178,9 +1170,9 @@ "dev": true }, "eslint": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz", - "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz", + "integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1191,7 +1183,7 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", - "eslint-scope": "^5.1.0", + "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^1.3.0", "espree": "^7.3.0", @@ -1272,20 +1264,32 @@ "esutils": "^2.0.2" } }, - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" } }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } }, "has-flag": { "version": "4.0.0", @@ -1461,14 +1465,6 @@ "acorn": "^7.4.0", "acorn-jsx": "^5.2.0", "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } } }, "esprima": { @@ -3518,6 +3514,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/package.json b/package.json index 0d01cb815..432c45511 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "@wordpress/eslint-plugin": "^7.2.1", - "eslint": "^7.9.0", + "eslint": "^7.10.0", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", From cfc62335d264f070499911aaa4f38875c3def605 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Tue, 29 Sep 2020 12:04:46 -0400 Subject: [PATCH 19/25] Record list table "No items" message updated --- classes/class-list-table.php | 2 +- languages/stream-en_US.po | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/class-list-table.php b/classes/class-list-table.php index f58277aff..ecd141df7 100644 --- a/classes/class-list-table.php +++ b/classes/class-list-table.php @@ -99,7 +99,7 @@ public function extra_tablenav( $which ) { public function no_items() { ?>
-

+

Date: Wed, 30 Sep 2020 20:38:17 -0400 Subject: [PATCH 20/25] Syntax error in Posts connector test breaking Travis-CI fixed. --- tests/tests/connectors/test-class-connector-posts.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tests/connectors/test-class-connector-posts.php b/tests/tests/connectors/test-class-connector-posts.php index 149637e31..e20ea4ce3 100644 --- a/tests/tests/connectors/test-class-connector-posts.php +++ b/tests/tests/connectors/test-class-connector-posts.php @@ -35,7 +35,7 @@ public function setUp() { // Make partial of Connector_Posts class, with mocked "log" function. $this->mock = $this->getMockBuilder( Connector_Posts::class ) - ->setMethods( [ 'log' ] ) + ->setMethods( array( 'log' ) ) ->getMock(); // Register connector. @@ -334,7 +334,7 @@ function( $subject ) { $this->greaterThan( 0 ), $this->equalTo( 'post' ), $this->equalTo( 'created' ), - ), + ) ); // Create post/update post status trigger callbacks. From 5c3058f5deedcc3659a4ed39ac6c361b00a19732 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 5 Oct 2020 14:32:25 -0400 Subject: [PATCH 21/25] some connector test cleaned up. --- package-lock.json | 14 +++--- .../connectors/test-class-connector-acf.php | 8 ++-- .../connectors/test-class-connector-edd.php | 48 +++++++++++-------- .../test-class-connector-taxonomies.php | 8 ++-- .../test-class-connector-user-switching.php | 6 +-- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index b201376ba..2849f0faf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -287,6 +287,14 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" + }, + "dependencies": { + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + } } }, "@wordpress/prettier-config": { @@ -3514,12 +3522,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/tests/tests/connectors/test-class-connector-acf.php b/tests/tests/connectors/test-class-connector-acf.php index 8259544ef..f2de880f0 100644 --- a/tests/tests/connectors/test-class-connector-acf.php +++ b/tests/tests/connectors/test-class-connector-acf.php @@ -149,7 +149,7 @@ public function test_callback_save_post() { $this->update_acf_field(); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_save_post' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_save_post' ) ); // 'acf/update_field_group' is called at the end of "acf_update_field()". $this->assertSame( 1, did_action( 'acf/update_field_group' ) ); @@ -185,7 +185,7 @@ public function test_callback_post_updated() { $this->update_acf_field_group( $field_group ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_post_updated' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_post_updated' ) ); // 'acf/update_field_group' is called at the end of "acf_update_field()". $this->assertSame( 2, did_action( 'acf/update_field_group' ) ); @@ -289,7 +289,7 @@ public function test_check_meta_values() { update_field( 'test_field', 'Yes sir!', "user_{$user_id}" ); // Check callback test actions. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_added_post_meta' ) ); - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_updated_post_meta' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_added_post_meta' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_updated_post_meta' ) ); } } diff --git a/tests/tests/connectors/test-class-connector-edd.php b/tests/tests/connectors/test-class-connector-edd.php index bb457995f..25b2fb89f 100644 --- a/tests/tests/connectors/test-class-connector-edd.php +++ b/tests/tests/connectors/test-class-connector-edd.php @@ -12,7 +12,13 @@ class Test_WP_Stream_Connector_EDD extends WP_StreamTestCase { * Runs before all tests */ public static function wpSetUpBeforeClass() { + global $wpdb; + + $suppress = $wpdb->suppress_errors(); + edd_install(); + + $wpdb->suppress_errors( $suppress ); } /** @@ -28,7 +34,7 @@ public function setUp() { // Make partial of Connector_EDD class, with mocked "log" function. $this->mock = $this->getMockBuilder( Connector_EDD::class ) - ->setMethods( [ 'log' ] ) + ->setMethods( array( 'log' ) ) ->getMock(); $this->mock->register(); @@ -117,7 +123,7 @@ public function test_check() { $this->mock->expects( $this->exactly( 3 ) ) ->method( 'log' ) ->withConsecutive( - [ + array( $this->equalTo( __( '"%s" setting updated', 'stream' ) ), $this->equalTo( array( @@ -131,8 +137,8 @@ public function test_check() { $this->equalTo( null ), $this->equalTo( 'settings' ), $this->equalTo( 'updated' ) - ], - [ + ), + array( $this->equalTo( __( '"%s" setting updated', 'stream' ) ), $this->equalTo( array( @@ -146,8 +152,8 @@ public function test_check() { $this->equalTo( null ), $this->equalTo( 'settings' ), $this->equalTo( 'updated' ) - ], - [ + ), + array( $this->equalTo( __( '"%s" setting updated', 'stream' ) ), $this->equalTo( array( @@ -161,7 +167,7 @@ public function test_check() { $this->equalTo( null ), $this->equalTo( 'settings' ), $this->equalTo( 'updated' ) - ] + ) ); // Update option to trigger callback. @@ -170,8 +176,8 @@ public function test_check() { edd_update_option( 'thousands_separator' ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_add_option' ) ); - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_update_option' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_add_option' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_update_option' ) ); } public function test_log_override() { @@ -214,10 +220,10 @@ public function test_callback_edd_pre_update_discount_status() { ) ), $this->equalTo( - [ + array( 'post_id' => $post_id, 'status' => 'inactive', - ] + ) ), $this->equalTo( $post_id ), $this->equalTo( 'discounts' ), @@ -228,7 +234,7 @@ public function test_callback_edd_pre_update_discount_status() { $discount->update_status( 'inactive' ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edd_pre_update_discount_status' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_edd_pre_update_discount_status' ) ); } public function test_settings_transport_callbacks() { @@ -236,20 +242,20 @@ public function test_settings_transport_callbacks() { $this->mock->expects( $this->exactly( 2 ) ) ->method( 'log' ) ->withConsecutive( - [ + array( $this->equalTo( __( 'Imported Settings', 'stream' ) ), $this->equalTo( array() ), $this->equalTo( null ), $this->equalTo( 'settings' ), $this->equalTo( 'imported' ), - ], - [ + ), + array( $this->equalTo( __( 'Exported Settings', 'stream' ) ), $this->equalTo( array() ), $this->equalTo( null ), $this->equalTo( 'settings' ), $this->equalTo( 'exported' ), - ] + ) ); // Manually trigger callbacks. @@ -257,13 +263,13 @@ public function test_settings_transport_callbacks() { do_action( 'edd_export_settings' ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edd_import_settings' ) ); - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edd_export_settings' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_edd_import_settings' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_edd_export_settings' ) ); } public function test_meta() { // Create and authenticate user. - $user_id = self::factory()->user->create( [ 'role' => 'administrator' ] ); + $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); \wp_set_current_user( $user_id ); // Expected log calls. @@ -271,7 +277,7 @@ public function test_meta() { ->method( 'log' ) ->with( $this->equalTo( __( 'User API Key created', 'stream' ) ), - $this->equalTo( [ 'meta_value' => 1 ] ), + $this->equalTo( array( 'meta_value' => 1 ) ), $this->equalTo( $user_id ), $this->equalTo( 'api_keys' ), 'created' @@ -282,6 +288,6 @@ public function test_meta() { \edd_update_user_api_key( $user_id ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_add_user_meta' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_add_user_meta' ) ); } } diff --git a/tests/tests/connectors/test-class-connector-taxonomies.php b/tests/tests/connectors/test-class-connector-taxonomies.php index 2a4ee5383..fa7267381 100644 --- a/tests/tests/connectors/test-class-connector-taxonomies.php +++ b/tests/tests/connectors/test-class-connector-taxonomies.php @@ -57,7 +57,7 @@ function( $subject ) { wp_insert_term( 'test', 'category' ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_created_term' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_created_term' ) ); } public function test_callback_delete_term() { @@ -93,7 +93,7 @@ public function test_callback_delete_term() { wp_delete_term( $term_data['term_id'], 'category' ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_delete_term' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_delete_term' ) ); } public function test_callback_edited_term() { @@ -137,7 +137,7 @@ public function test_callback_edited_term() { ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edit_term' ) ); - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_edited_term' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_edit_term' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_edited_term' ) ); } } diff --git a/tests/tests/connectors/test-class-connector-user-switching.php b/tests/tests/connectors/test-class-connector-user-switching.php index 04f6b8944..4368e0334 100644 --- a/tests/tests/connectors/test-class-connector-user-switching.php +++ b/tests/tests/connectors/test-class-connector-user-switching.php @@ -81,7 +81,7 @@ public function test_callback_switch_to_user() { \switch_to_user( $user_id ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_switch_to_user' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_switch_to_user' ) ); } public function test_callback_switch_back_user() { @@ -131,7 +131,7 @@ public function test_callback_switch_back_user() { \switch_to_user( $old_user_id, false, false ); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_switch_back_user' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_switch_back_user' ) ); } public function test_callback_switch_off_user() { @@ -160,6 +160,6 @@ public function test_callback_switch_off_user() { \switch_off_user(); // Check callback test action. - $this->assertGreaterThan( 0, did_action( 'wp_stream_test_callback_switch_off_user' ) ); + $this->assertGreaterThan( 0, did_action( $this->action_prefix . 'callback_switch_off_user' ) ); } } From 40709adacf485b115708d963943449d1b1ef66d5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 6 Oct 2020 04:15:38 +0000 Subject: [PATCH 22/25] Update dependency @wordpress/eslint-plugin to ^7.3.0 --- package-lock.json | 102 +++++++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/package-lock.json b/package-lock.json index b201376ba..2499a69ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -269,9 +269,9 @@ } }, "@wordpress/eslint-plugin": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-7.2.1.tgz", - "integrity": "sha512-p4LrUukVyuZAH/vSHFOV5L0NHW2i8WegOYFDgYCIzcWCi/A7jW1O+vUA5ylm1rRCKqj8Z/4WIMOGflf/8delYw==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-7.3.0.tgz", + "integrity": "sha512-7wIFzzc14E1XuuT9haBuhoA9FRUGWlbD4Oek+XkiZlzNVqZI3slgbtIFJ6/Mfij1V18rv6Ns9a1cPJLtCU8JHQ==", "dev": true, "requires": { "@wordpress/prettier-config": "^0.4.0", @@ -287,6 +287,14 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" + }, + "dependencies": { + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + } } }, "@wordpress/prettier-config": { @@ -1134,20 +1142,20 @@ } }, "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", + "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", + "is-callable": "^1.2.2", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" } @@ -1324,9 +1332,9 @@ } }, "eslint-config-prettier": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", - "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz", + "integrity": "sha512-9jWPlFlgNwRUYVoujvWTQ1aMO8o6648r+K7qU7K5Jmkbyqav1fuEZC0COYpGBxyiAJb65Ra9hrmFx19xRGwXWw==", "dev": true, "requires": { "get-stdin": "^6.0.0" @@ -1342,9 +1350,9 @@ } }, "eslint-plugin-jsdoc": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.5.1.tgz", - "integrity": "sha512-cY3YNxdhFcQVkcQLnZw/iZGsTPMuWa9yWZclorMWkjdHprBQX0TMWMEcmJYM3IjHp1HJr7aD0Z0sCRifEBhnzg==", + "version": "30.6.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.6.3.tgz", + "integrity": "sha512-RnyM+a3SKRfPs/jqO2qOGAEZnOJT2dOhiwhBlYVp8/yRUUBNPlvkwZm0arrnyFKvfZX6WqSwlK5OcNnM5W1Etg==", "dev": true, "requires": { "comment-parser": "^0.7.6", @@ -1407,9 +1415,9 @@ } }, "eslint-plugin-react": { - "version": "7.20.6", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.20.6.tgz", - "integrity": "sha512-kidMTE5HAEBSLu23CUDvj8dc3LdBU0ri1scwHBZjI41oDv4tjsWZKU7MQccFzH1QYPYhsnTF2ovh7JlcIcmxgg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.21.3.tgz", + "integrity": "sha512-OI4GwTCqyIb4ipaOEGLWdaOHCXZZydStAsBEPB2e1ZfNM37bojpgO1BoOQbFb0eLVz3QLDx7b+6kYcrxCuJfhw==", "dev": true, "requires": { "array-includes": "^3.1.1", @@ -1432,12 +1440,12 @@ "dev": true }, "eslint-scope": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", - "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "requires": { - "esrecurse": "^4.1.0", + "esrecurse": "^4.3.0", "estraverse": "^4.1.1" } }, @@ -1491,12 +1499,20 @@ } }, "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "requires": { - "estraverse": "^4.1.0" + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } } }, "estraverse": { @@ -2586,9 +2602,9 @@ "dev": true }, "is-callable": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.1.tgz", - "integrity": "sha512-wliAfSzx6V+6WfMOmus1xy0XvSgf/dlStkvTfq7F0g4bOIW0PSUbnyse3NhDwdyYS1ozfUtAAySqTws3z9Eqgg==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", "dev": true }, "is-data-descriptor": { @@ -3245,21 +3261,21 @@ }, "dependencies": { "es-abstract": { - "version": "1.18.0-next.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz", - "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==", + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", + "is-callable": "^1.2.2", "is-negative-zero": "^2.0.0", "is-regex": "^1.1.1", "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" } @@ -3514,12 +3530,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", @@ -3854,21 +3864,21 @@ }, "dependencies": { "es-abstract": { - "version": "1.18.0-next.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz", - "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==", + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", + "is-callable": "^1.2.2", "is-negative-zero": "^2.0.0", "is-regex": "^1.1.1", "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" } diff --git a/package.json b/package.json index 432c45511..53c448d03 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "track" ], "devDependencies": { - "@wordpress/eslint-plugin": "^7.2.1", + "@wordpress/eslint-plugin": "^7.3.0", "eslint": "^7.10.0", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", From d459ff9e21bfa4f0ce6f3fb387ef9f4238101325 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 9 Oct 2020 20:51:08 +0000 Subject: [PATCH 23/25] Update dependency eslint to ^7.11.0 --- package-lock.json | 66 +++++++++++++++-------------------------------- package.json | 2 +- 2 files changed, 22 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2499a69ca..0257f9922 100644 --- a/package-lock.json +++ b/package-lock.json @@ -287,14 +287,6 @@ "globals": "^12.0.0", "prettier": "npm:wp-prettier@2.0.5", "requireindex": "^1.2.0" - }, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.0.5", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", - "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", - "dev": true - } } }, "@wordpress/prettier-config": { @@ -310,9 +302,9 @@ "dev": true }, "acorn": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, "acorn-jsx": { @@ -1178,9 +1170,9 @@ "dev": true }, "eslint": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz", - "integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.11.0.tgz", + "integrity": "sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1193,7 +1185,7 @@ "enquirer": "^2.3.5", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^1.3.0", + "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.0", "esquery": "^1.2.0", "esutils": "^2.0.2", @@ -1229,12 +1221,11 @@ "dev": true }, "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -1272,32 +1263,11 @@ "esutils": "^2.0.2" } }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true }, "has-flag": { "version": "4.0.0", @@ -3530,6 +3500,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==", + "dev": true + }, "prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", diff --git a/package.json b/package.json index 53c448d03..97aa5626a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "@wordpress/eslint-plugin": "^7.3.0", - "eslint": "^7.10.0", + "eslint": "^7.11.0", "grunt": "~1.3.0", "grunt-contrib-clean": "~2.0.0", "grunt-contrib-compress": "^1.6.0", From 6e3709b76a40c3a15f5c923d52fdcd68f03695f4 Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Wed, 14 Oct 2020 10:04:24 +0300 Subject: [PATCH 24/25] Version bump --- classes/class-plugin.php | 2 +- readme.txt | 2 +- stream.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/class-plugin.php b/classes/class-plugin.php index e65d9db1e..02264a505 100755 --- a/classes/class-plugin.php +++ b/classes/class-plugin.php @@ -18,7 +18,7 @@ class Plugin { * * @const string */ - const VERSION = '3.5.1'; + const VERSION = '3.6.0'; /** * WP-CLI command diff --git a/readme.txt b/readme.txt index 73060185b..782a0d2d2 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: xwp Tags: wp stream, stream, activity, logs, track Requires at least: 4.5 Tested up to: 5.5 -Stable tag: 3.5.1 +Stable tag: 3.6.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/stream.php b/stream.php index 3d0a84c1f..f4f9d124d 100644 --- a/stream.php +++ b/stream.php @@ -3,7 +3,7 @@ * Plugin Name: Stream * Plugin URI: https://xwp.co/work/stream/ * Description: Stream tracks logged-in user activity so you can monitor every change made on your WordPress site in beautifully organized detail. All activity is organized by context, action and IP address for easy filtering. Developers can extend Stream with custom connectors to log any kind of action. - * Version: 3.5.1 + * Version: 3.6.0 * Author: XWP * Author URI: https://xwp.co * License: GPLv2+ From aba3a215a9016901ec91f0bde4136edcc1b1461e Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Wed, 14 Oct 2020 10:21:43 +0300 Subject: [PATCH 25/25] Add the changelog --- readme.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.txt b/readme.txt index 782a0d2d2..135bfd5cd 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,15 @@ Past Contributors: fjarrett, shadyvb, chacha, westonruter, johnregan3, jacobschw == Changelog == += 3.6.0 - October 14, 2020 = + +* New: Introduce the `wp_stream_db_query_where` filter [#1160](https://github.com/xwp/stream/pull/1160), props [@kidunot89](https://github.com/kidunot89) and [@nprasath002](https://github.com/nprasath002). +* Fix: Replace the deprecated jQuery `.load()` calls [#1162](https://github.com/xwp/stream/pull/1162), props [@kidunot89](https://github.com/kidunot89). +* Fix: Log the correct post status change [#1121](https://github.com/xwp/stream/pull/1121), props [@kidunot89](https://github.com/kidunot89). +* Fix: Update the [Advanced Custom Fields](https://wordpress.org/plugins/advanced-custom-fields/) connector to support versions 5 of the plugin [#1118](https://github.com/xwp/stream/pull/1118), props [@kidunot89](https://github.com/kidunot89). +* Fix: Update the [Easy Digital Downloads](https://wordpress.org/plugins/easy-digital-downloads/) connector to support version 2.5 of the plugin [#1137](https://github.com/xwp/stream/pull/1137), props [@kidunot89](https://github.com/kidunot89). +* Tweak: Clarify the messaging when no Stream records found [#1178](https://github.com/xwp/stream/issues/1178), props [@kidunot89](https://github.com/kidunot89) and [@johnbillion](https://github.com/johnbillion). + = 3.5.1 - August 14, 2020 = * Fix: Use the correct timestamp format when saving Stream records to ensure correct dates on newer versions of MySQL [#1149](https://github.com/xwp/stream/issues/1149), props [@kidunot89](https://github.com/kidunot89).