From ba8f30156986fea7c7d4c02ce7d5cafb74edc75f Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 3 Aug 2020 15:07:37 -0400 Subject: [PATCH] Documentation added to GravityForms connector test --- composer.lock | 520 +++++++++++++++--- tests/bootstrap.php | 6 +- .../test-class-connector-gravityforms.php | 267 +++++---- 3 files changed, 632 insertions(+), 161 deletions(-) diff --git a/composer.lock b/composer.lock index 1e7180eb3..4272aa58a 100644 --- a/composer.lock +++ b/composer.lock @@ -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", @@ -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.0", "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.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a57f8161502549a742a63c09f0a604997bf47027" + "reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe" }, "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/bc6549d068d0160e0f10f7a5a23c7d1406b95ebe", + "reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe", "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-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.18.0", + "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.0", "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.0", + "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.1", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a" + "reference": "639447d008615574653fb3bc60d1986d7172eaae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a", - "reference": "3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", + "reference": "639447d008615574653fb3bc60d1986d7172eaae", "shasum": "" }, "require": { @@ -3293,7 +3645,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3344,20 +3696,20 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" + "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": { @@ -3393,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", @@ -3442,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": { @@ -3501,7 +3881,21 @@ ], "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", diff --git a/tests/bootstrap.php b/tests/bootstrap.php index f3e85b0e6..3bd3e51fc 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -23,7 +23,7 @@ * @param array $active_plugins * @return array */ -function xwp_filter_active_plugins_for_phpunit( $active_plugins ) { +function stream_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 ); @@ -36,8 +36,8 @@ function xwp_filter_active_plugins_for_phpunit( $active_plugins ) { } 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( 'site_option_active_sitewide_plugins', 'stream_filter_active_plugins_for_phpunit' ); +tests_add_filter( 'option_active_plugins', 'stream_filter_active_plugins_for_phpunit' ); tests_add_filter( 'muplugins_loaded', diff --git a/tests/tests/connectors/test-class-connector-gravityforms.php b/tests/tests/connectors/test-class-connector-gravityforms.php index e02647954..e179cbf5c 100644 --- a/tests/tests/connectors/test-class-connector-gravityforms.php +++ b/tests/tests/connectors/test-class-connector-gravityforms.php @@ -1,14 +1,23 @@ register(); - // Make partial of Connector_ACF class, with mocked "log" function. + // Make partial of Connector_GravityForms class, with mocked "log" function. $this->mock = $this->getMockBuilder( Connector_GravityForms::class ) ->setMethods( [ 'log' ] ) ->getMock(); @@ -16,6 +25,9 @@ public function setUp() { $this->mock->register(); } + /** + * Runs after each test + */ public function tearDown() { parent::tearDown(); } @@ -24,10 +36,18 @@ public function test_gravityforms_installed_and_activated() { $this->assertTrue( class_exists( 'GFForms' ) ); } + /** + * Creates a new form. + * + * @param array $form Form configurations. + * @param array $fields Form fields configurations. + * + * @return int + */ public function create_form( $form = array(), $fields = array() ) { $form = array_merge( $form, - array( + array( 'title' => 'Test form', 'description' => 'Form for Field Tests Description', 'fields' => $this->create_fields( $fields ) @@ -38,49 +58,56 @@ public function create_form( $form = array(), $fields = array() ) { return $form_id; } + /** + * Returns form field object. + * + * @param array $fields Form field configurations. + * + * @return array + */ public function create_fields( $fields = array() ) { $fields = ! empty( $fields ) ? $fields : array( array( - 'type' => 'text', - 'id' => 1, - 'label' => 'Single Line Text', - 'adminLabel' => '', - 'isRequired' => false, - 'size' => 'medium', - 'errorMessage' => '', - 'visibility' => 'visible', - 'inputs' => null, - 'formId' => 2, - 'description' => 'I am a single line text field.', - 'allowsPrepopulate' => false, - 'inputMask' => false, - 'inputMaskValue' => '', - 'inputMaskIsCustom' => false, - 'maxLength' => '', - 'inputType' => '', - 'labelPlacement' => '', + 'type' => 'text', + 'id' => 1, + 'label' => 'Single Line Text', + 'adminLabel' => '', + 'isRequired' => false, + 'size' => 'medium', + 'errorMessage' => '', + 'visibility' => 'visible', + 'inputs' => null, + 'formId' => 2, + 'description' => 'I am a single line text field.', + 'allowsPrepopulate' => false, + 'inputMask' => false, + 'inputMaskValue' => '', + 'inputMaskIsCustom' => false, + 'maxLength' => '', + 'inputType' => '', + 'labelPlacement' => '', 'descriptionPlacement' => '', - 'subLabelPlacement' => '', - 'placeholder' => '', - 'cssClass' => '', - 'inputName' => '', - 'noDuplicates' => false, - 'defaultValue' => '', - 'choices' => '', - 'productField' => '', - 'enablePasswordInput' => '', - 'multipleFiles' => false, - 'maxFiles' => '', - 'calculationFormula' => '', - 'calculationRounding' => '', - 'enableCalculation' => '', - 'disableQuantity' => false, + 'subLabelPlacement' => '', + 'placeholder' => '', + 'cssClass' => '', + 'inputName' => '', + 'noDuplicates' => false, + 'defaultValue' => '', + 'choices' => '', + 'productField' => '', + 'enablePasswordInput' => '', + 'multipleFiles' => false, + 'maxFiles' => '', + 'calculationFormula' => '', + 'calculationRounding' => '', + 'enableCalculation' => '', + 'disableQuantity' => false, 'displayAllCategories' => false, - 'useRichTextEditor' => false, - 'checkboxLabel' => '', - 'pageNumber' => 1, - 'fields' => '', - 'displayOnly' => '', + 'useRichTextEditor' => false, + 'checkboxLabel' => '', + 'pageNumber' => 1, + 'fields' => '', + 'displayOnly' => '', ), ); @@ -88,6 +115,7 @@ public function create_fields( $fields = array() ) { } public function test_callback_gform_after_save_form() { + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->with( @@ -103,16 +131,18 @@ public function test_callback_gform_after_save_form() { $this->equalTo( 'created' ) ); - // Do stuff. + // Create form and trigger save callback. $form_id = $this->create_form(); $form_meta = \GFFormsModel::get_form_meta( $form_id ); do_action( 'gform_after_save_form', $form_meta, true, array() ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_after_save_form' ) ); } public function test_callback_gform_pre_confirmation_save() { + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->with( @@ -129,7 +159,7 @@ public function test_callback_gform_pre_confirmation_save() { $this->equalTo( 'updated' ) ); - // Do stuff. + // Create form and confirmation to trigger callback. $confirmation = array( 'id' => uniqid(), 'name' => 'Test confirmation', @@ -141,17 +171,19 @@ public function test_callback_gform_pre_confirmation_save() { 'queryString' => '', ); - $form_id = $this->create_form( + $form_id = $this->create_form( array( 'confirmations' => array( $confirmation['id'] => $confirmation ) ) ); - $form = \GFAPI::get_form( $form_id ); + $form = \GFAPI::get_form( $form_id ); \gf_apply_filters( array( 'gform_pre_confirmation_save', $form_id ), $confirmation, $form, true ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_pre_confirmation_save' ) ); } public function test_callback_gform_pre_notification_save() { + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->with( @@ -168,7 +200,7 @@ public function test_callback_gform_pre_notification_save() { $this->equalTo( 'updated' ) ); - // Do stuff. + // Create form and notification to trigger callback. $notification = array( 'id' => uniqid(), 'to' => '{admin_email}', @@ -179,33 +211,19 @@ public function test_callback_gform_pre_notification_save() { 'message' => '{all_fields}', ); - $form_id = $this->create_form( + $form_id = $this->create_form( array( 'notifications' => array( $notification['id'] => $notification ) ) ); - $form = \GFAPI::get_form( $form_id ); + $form = \GFAPI::get_form( $form_id ); \gf_apply_filters( array( 'gform_pre_notification_save', $form_id ), $notification, $form, true ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_pre_notification_save' ) ); } public function test_callback_gform_pre_notification_deleted() { - $this->mock->expects( $this->atLeastOnce() ) - ->method( 'log' ) - ->with( - $this->equalTo( __( '"%1$s" notification deleted from "%2$s"', 'stream' ) ), - $this->equalTo( - array( - 'title' => 'Test notification', - 'form_title' => 'Test form', - ) - ), - $this->greaterThan( 0 ), - $this->equalTo( 'forms' ), - $this->equalTo( 'updated' ) - ); - - // Do stuff. + // Create form and notification for later use. $notification = array( 'id' => uniqid(), 'to' => '{admin_email}', @@ -220,19 +238,15 @@ public function test_callback_gform_pre_notification_deleted() { array( 'notifications' => array( $notification['id'] => $notification ) ) ); $form = \GFAPI::get_form( $form_id ); - \GFNotification::delete_notification( $notification['id'], $form_id ); - - $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_pre_notification_deleted' ) ); - } - public function test_callback_gform_pre_confirmation_deleted() { + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->with( - $this->equalTo( __( '"%1$s" confirmation deleted from "%2$s"', 'stream' ) ), + $this->equalTo( __( '"%1$s" notification deleted from "%2$s"', 'stream' ) ), $this->equalTo( array( - 'title' => 'Test confirmation', + 'title' => 'Test notification', 'form_title' => 'Test form', ) ), @@ -241,7 +255,15 @@ public function test_callback_gform_pre_confirmation_deleted() { $this->equalTo( 'updated' ) ); - // Do stuff. + // Delete notification to trigger callback. + \GFNotification::delete_notification( $notification['id'], $form_id ); + + // Check callback test action.. + $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_pre_notification_deleted' ) ); + } + + public function test_callback_gform_pre_confirmation_deleted() { + // Create form and notification for later use. $confirmation = array( 'id' => uniqid(), 'name' => 'Test confirmation', @@ -258,12 +280,31 @@ public function test_callback_gform_pre_confirmation_deleted() { ); $form = \GFAPI::get_form( $form_id ); + // Expected log calls. + $this->mock->expects( $this->atLeastOnce() ) + ->method( 'log' ) + ->with( + $this->equalTo( __( '"%1$s" confirmation deleted from "%2$s"', 'stream' ) ), + $this->equalTo( + array( + 'title' => 'Test confirmation', + 'form_title' => 'Test form', + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'forms' ), + $this->equalTo( 'updated' ) + ); + + // Delete confirmation to trigger callback. \GFFormSettings::delete_confirmation( $confirmation['id'], $form_id ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_pre_confirmation_deleted' ) ); } public function test_check() { + // Expected log calls. $this->mock->expects( $this->exactly( 4 ) ) ->method( 'log' ) ->withConsecutive( @@ -323,17 +364,19 @@ public function test_check() { ] ); - // Do stuff. + // Update options to trigger callbacks. update_option( 'rg_gforms_currency', '$' ); update_option( 'rg_gforms_key', 'blahblahblah' ); update_option( 'rg_gforms_currency', '£' ); update_option( 'rg_gforms_key', '' ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_add_option' ) ); $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_update_option' ) ); } public function test_callback_gform_delete_lead() { + // Create form and entry for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -360,6 +403,7 @@ public function test_callback_gform_delete_lead() { ) ); + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->with( @@ -376,13 +420,15 @@ public function test_callback_gform_delete_lead() { $this->equalTo( 'deleted' ) ); - // Do stuff. + // Delete entry to trigger callback. \GFFormsModel::delete_entry( $entry_id ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_delete_lead' ) ); } public function test_callback_gform_post_note_added() { + // Create and authenticate user. $user_id = self::factory()->user->create( array( 'username' => 'johndoe', @@ -390,21 +436,8 @@ public function test_callback_gform_post_note_added() { ) ); \wp_set_current_user( $user_id ); - $this->mock->expects( $this->once() ) - ->method( 'log' ) - ->with( - $this->equalTo( __( 'Note #%1$d added to lead #%2$d on "%3$s" form', 'stream' ) ), - $this->callback( - function( $args ) { - return ! empty( $args['form_title' ] ) && $args['form_title'] === 'Test form'; - } - ), - $this->greaterThan( 0 ), - $this->equalTo( 'notes' ), - $this->equalTo( 'added' ) - ); - // Do stuff. + // Create form and entry for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -430,15 +463,34 @@ function( $args ) { 'status' => 'active', ) ); + + // Expected log calls. + $this->mock->expects( $this->once() ) + ->method( 'log' ) + ->with( + $this->equalTo( __( 'Note #%1$d added to lead #%2$d on "%3$s" form', 'stream' ) ), + $this->callback( + function( $args ) { + return ! empty( $args['form_title' ] ) && $args['form_title'] === 'Test form'; + } + ), + $this->greaterThan( 0 ), + $this->equalTo( 'notes' ), + $this->equalTo( 'added' ) + ); + + // Create note to trigger callback. $note = 'Lorem ipsum dolor...'; \GFFormsModel::add_note( $entry_id, $user_id, 'johndoe', $note, 'user' ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_post_note_added' ) ); } public function test_callback_gform_pre_note_deleted() { global $wpdb; + // Create and authenticate user. $user_id = self::factory()->user->create( array( 'username' => 'johndoe', @@ -446,6 +498,8 @@ public function test_callback_gform_pre_note_deleted() { ) ); \wp_set_current_user( $user_id ); + + // Create form, entry, and note for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -482,6 +536,7 @@ function( $id ) use ( &$note_id ) { ); \GFFormsModel::add_note( $entry_id, $user_id, 'johndoe', 'Lorem ipsum dolor...' ); + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->with( @@ -499,13 +554,15 @@ function( $id ) use ( &$note_id ) { $this->equalTo( 'deleted' ) ); - // Do stuff. + // Delete note and trigger callback. \GFFormsModel::delete_note( $note_id ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_pre_note_deleted' ) ); } public function test_callback_gform_update_status() { + // Create form and entry for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -532,6 +589,7 @@ public function test_callback_gform_update_status() { ) ); + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->withConsecutive( @@ -567,16 +625,18 @@ public function test_callback_gform_update_status() { ] ); - // Do stuff. + // Update form status and manually trigger callback. \gform_update_meta( $entry_id, 'status', 'trash' ); do_action( 'gform_update_status', $entry_id, 'trash', 'active' ); \gform_update_meta( $entry_id, 'status', 'active' ); do_action( 'gform_update_status', $entry_id, 'active', 'trash' ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_update_status' ) ); } public function test_callback_gform_update_is_read() { + // Create form for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -603,6 +663,7 @@ public function test_callback_gform_update_is_read() { ) ); + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->withConsecutive( @@ -636,14 +697,16 @@ public function test_callback_gform_update_is_read() { ] ); - // Do stuff. + // Update entry "is_read" and trigger callback. \GFFormsModel::update_entry_property( $entry_id, 'is_read', 1 ); \GFFormsModel::update_entry_property( $entry_id, 'is_read', 0 ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_update_is_read' ) ); } public function test_callback_gform_update_is_starred() { + // Create form and entry for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -670,6 +733,7 @@ public function test_callback_gform_update_is_starred() { ) ); + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->withConsecutive( @@ -703,14 +767,16 @@ public function test_callback_gform_update_is_starred() { ] ); - // Do stuff. + // Update entry "is_starred" and trigger callback. \GFFormsModel::update_entry_property( $entry_id, 'is_starred', 1 ); \GFFormsModel::update_entry_property( $entry_id, 'is_starred', 0 ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_update_is_starred' ) ); } public function test_log_form_action() { + // Create form and entry for later use. $form_id = $this->create_form(); $form = \GFAPI::get_form( $form_id ); $entry_id = \GFAPI::add_entry( @@ -737,6 +803,7 @@ public function test_log_form_action() { ) ); + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->withConsecutive( @@ -846,7 +913,7 @@ public function test_log_form_action() { ] ); - // Do stuff. + // Update form "status" to trigger callback. \GFFormsModel::update_form_active( $form_id, 0 ); \GFFormsModel::update_form_active( $form_id, 1 ); \RGFormsModel::trash_form( $form_id ); @@ -855,6 +922,7 @@ public function test_log_form_action() { \GFFormsModel::delete_views( $form_id ); \RGFormsModel::delete_form( $form_id ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_before_delete_form' ) ); $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_post_form_trashed' ) ); $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_post_form_restored' ) ); @@ -865,8 +933,10 @@ public function test_log_form_action() { } public function test_callback_gform_post_export_entries() { + // Create form for later use. $form_id = $this->create_form(); + // Expected log calls. $this->mock->expects( $this->once() ) ->method( 'log' ) ->with( @@ -884,22 +954,25 @@ public function test_callback_gform_post_export_entries() { $this->equalTo( 'exported' ) ); - // Do stuff. + // Execute form export and trigger callback. $form = \RGFormsModel::get_form_meta( $form_id ); $export_id = sanitize_key( wp_hash( uniqid( 'export', true ) ) ); $_POST['export_field'] = array( 'id' ); \GFExport::start_export( $form, 0, $export_id ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_post_export_entries' ) ); } public function test_callback_gform_forms_post_import() { + // Create form and export as json string for later use. $form_id = $this->create_form(); $forms = \GFFormsModel::get_form_meta_by_id( [ $form_id ] ); $forms = \GFExport::prepare_forms_for_export( $forms ); $forms['version'] = \GFForms::$version; $forms_json = json_encode( $forms ); + // Expected log calls. $this->mock->expects( $this->once() ) ->method( 'log' ) ->with( @@ -916,15 +989,18 @@ public function test_callback_gform_forms_post_import() { $this->equalTo( 'imported' ) ); - // Do stuff. + // Import form and trigger callback. \GFExport::import_json( $forms_json ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_forms_post_import' ) ); } public function test_callback_gform_export_form() { + // Create form for later use. $form_id = $this->create_form(); + // Expected log calls. $this->mock->expects( $this->once() ) ->method( 'log' ) ->with( @@ -940,10 +1016,11 @@ public function test_callback_gform_export_form() { $this->equalTo( 'exported' ) ); - // Do stuff. + // Export forms to trigger callback. $forms = \GFFormsModel::get_form_meta_by_id( array( $form_id ) ); \GFExport::prepare_forms_for_export( $forms ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_gform_export_form' ) ); } }