From dcd2577ef5d024b2ff68847fea59dd262505fdfa Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 3 Aug 2020 19:29:56 -0400 Subject: [PATCH] EDD connector test updated. --- composer.lock | 538 ++++++++++++++++-- .../connectors/test-class-connector-edd.php | 55 +- 2 files changed, 520 insertions(+), 73 deletions(-) diff --git a/composer.lock b/composer.lock index 9a8b0eef9..806d18476 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.0", + "version": "v1.18.0", "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,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/tests/connectors/test-class-connector-edd.php b/tests/tests/connectors/test-class-connector-edd.php index 4124fae4b..50bc75ea0 100644 --- a/tests/tests/connectors/test-class-connector-edd.php +++ b/tests/tests/connectors/test-class-connector-edd.php @@ -1,11 +1,23 @@ 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', @@ -62,6 +82,11 @@ private function create_simple_download() { return get_post( $post_id ); } + /** + * Create a percentage discount + * + * @return int + */ private function create_simple_percent_discount() { $post = array( 'code' => '20OFF', @@ -81,11 +106,12 @@ private function create_simple_percent_discount() { return $discount_id; } - public function test_bbpress_installed_and_activated() { + public function test_edd_installed_and_activated() { $this->assertTrue( class_exists( 'Easy_Digital_Downloads' ) ); } public function test_option_callbacks() { + // Expected log calls. $this->mock->expects( $this->atLeastOnce() ) ->method( 'log' ) ->withConsecutive( @@ -136,23 +162,23 @@ public function test_option_callbacks() { ] ); - // Do stuff. + // 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->assertFalse( 0 === did_action( 'wp_stream_test_callback_add_option' ) ); $this->assertFalse( 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'] && 'downloads' === $data['context'] ) { - $asserted++; - } elseif ( 'edd' === $data['connector'] && 'discounts' === $data['context'] ) { + if ( 'edd' === $data['connector'] && in_array( $data['context'], array( 'downloads', 'discounts' ), true ) ) { $asserted++; } @@ -161,17 +187,20 @@ function( $data ) use( &$asserted ) { 99 ); - // Do stuff. + // 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->atLeastOnce() ) ->method( 'log' ) ->with( @@ -193,19 +222,21 @@ public function test_callback_edd_pre_update_discount_status() { $this->equalTo( 'updated' ) ); - // Do stuff. + // Update discount status to trigger callback. $discount->update_status( 'inactive' ); + // Check callback test action. $this->assertFalse( 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->atLeastOnce() ) ->method( 'log' ) ->withConsecutive( [ $this->equalTo( __( 'Imported Settings', 'stream' ) ), - $this->equalTo( [] ), + $this->equalTo( array() ), $this->equalTo( null ), $this->equalTo( 'settings' ), $this->equalTo( 'imported' ), @@ -219,18 +250,21 @@ public function test_settings_transport_callbacks() { ] ); - // Do stuff. + // Manually trigger callbacks. do_action( 'edd_import_settings' ); do_action( 'edd_export_settings' ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_edd_import_settings' ) ); $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_edd_export_settings' ) ); } public function test_meta_callbacks() { + // 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->atLeastOnce() ) ->method( 'log' ) ->with( @@ -241,10 +275,11 @@ public function test_meta_callbacks() { 'created' ); - // Do stuff. + // Update API key and trigger callback.. $_POST['edd_set_api_key'] = 1; \edd_update_user_api_key( $user_id ); + // Check callback test action. $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_add_user_meta' ) ); } }