Merge pull request #24197 from woocommerce/feature/24192

Updated PHPUnit to 7.5.14
This commit is contained in:
Rodrigo Primo 2019-07-19 10:34:04 -03:00 committed by GitHub
commit 276334fc4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 191 additions and 557 deletions

View File

@ -59,7 +59,7 @@ before_script:
# Install WP Test suite, install PHPUnit globally:
if [[ ! -z "$WP_VERSION" ]]; then
bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
composer global require "phpunit/phpunit=4.8.*|6.5.*"
composer global require "phpunit/phpunit=5.7.*|7.5.*"
fi
script:

View File

@ -8,19 +8,19 @@
"minimum-stability": "dev",
"require": {
"automattic/jetpack-autoloader": "1.2.0",
"php": "^5.6|^7.0",
"php": ">=5.6|>=7.0",
"composer/installers": "1.6.0",
"woocommerce/woocommerce-blocks": "2.3.0-beta",
"woocommerce/woocommerce-rest-api": "1.0.3"
},
"require-dev": {
"myclabs/deep-copy": "1.7.0",
"phpunit/phpunit": "6.5.14",
"phpunit/phpunit": "7.5.14",
"woocommerce/woocommerce-sniffs": "0.0.6"
},
"config": {
"platform": {
"php": "7.0"
"php": "7.1"
},
"preferred-install": {
"woocommerce/woocommerce-rest-api": "dist",

304
composer.lock generated
View File

@ -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": "2ae85d17d88de2a1ff50e32bbd85b1db",
"content-hash": "8b2833a3907261e9b1fb056fe56c9dfb",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -319,32 +319,34 @@
},
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
"reference": "a2c590166b2133a4633738648b6b064edae0814a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
"reference": "a2c590166b2133a4633738648b6b064edae0814a",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
"php": "^7.1"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"doctrine/coding-standard": "^6.0",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
"phpbench/phpbench": "^0.13",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.2.x-dev"
}
},
"autoload": {
@ -364,12 +366,12 @@
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14T21:17:01+00:00"
"time": "2019-03-17T17:37:11+00:00"
},
{
"name": "myclabs/deep-copy",
@ -418,22 +420,22 @@
},
{
"name": "phar-io/manifest",
"version": "1.0.1",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0"
"reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0",
"reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
"reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-phar": "*",
"phar-io/version": "^1.0.1",
"phar-io/version": "^2.0",
"php": "^5.6 || ^7.0"
},
"type": "library",
@ -469,20 +471,20 @@
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"time": "2017-03-05T18:14:27+00:00"
"time": "2018-07-08T19:23:20+00:00"
},
{
"name": "phar-io/version",
"version": "1.0.1",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "a70c0ced4be299a63d32fa96d9281d03e94041df"
"reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df",
"reference": "a70c0ced4be299a63d32fa96d9281d03e94041df",
"url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
"reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
"shasum": ""
},
"require": {
@ -516,7 +518,7 @@
}
],
"description": "Library for handling version information and constraints",
"time": "2017-03-05T17:38:23+00:00"
"time": "2018-07-08T19:19:57+00:00"
},
{
"name": "phpcompatibility/php-compatibility",
@ -893,40 +895,40 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "5.3.2",
"version": "6.1.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "c89677919c5dd6d3b3852f230a663118762218ac"
"reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac",
"reference": "c89677919c5dd6d3b3852f230a663118762218ac",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^7.0",
"phpunit/php-file-iterator": "^1.4.2",
"php": "^7.1",
"phpunit/php-file-iterator": "^2.0",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-token-stream": "^2.0.1",
"phpunit/php-token-stream": "^3.0",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.0",
"sebastian/environment": "^3.1 || ^4.0",
"sebastian/version": "^2.0.1",
"theseer/tokenizer": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"phpunit/phpunit": "^7.0"
},
"suggest": {
"ext-xdebug": "^2.5.5"
"ext-xdebug": "^2.6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3.x-dev"
"dev-master": "6.1-dev"
}
},
"autoload": {
@ -952,29 +954,32 @@
"testing",
"xunit"
],
"time": "2018-04-06T15:36:58+00:00"
"time": "2018-10-31T16:06:48+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.5",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
"reference": "050bedf145a257b1ff02746c31894800e5122946"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946",
"reference": "050bedf145a257b1ff02746c31894800e5122946",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
@ -989,7 +994,7 @@
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
@ -999,7 +1004,7 @@
"filesystem",
"iterator"
],
"time": "2017-11-27T13:52:08+00:00"
"time": "2018-09-13T20:33:42+00:00"
},
{
"name": "phpunit/php-text-template",
@ -1044,28 +1049,28 @@
},
{
"name": "phpunit/php-timer",
"version": "1.0.9",
"version": "2.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
"reference": "1038454804406b0b5f5f520358e78c1c2f71501e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e",
"reference": "1038454804406b0b5f5f520358e78c1c2f71501e",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "2.1-dev"
}
},
"autoload": {
@ -1080,7 +1085,7 @@
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
@ -1089,33 +1094,33 @@
"keywords": [
"timer"
],
"time": "2017-02-26T11:10:40+00:00"
"time": "2019-06-07T04:22:29+00:00"
},
{
"name": "phpunit/php-token-stream",
"version": "2.0.2",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "791198a2c6254db10131eecfe8c06670700904db"
"reference": "c4a66b97f040e3e20b3aa2a243230a1c3a9f7c8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
"reference": "791198a2c6254db10131eecfe8c06670700904db",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c4a66b97f040e3e20b3aa2a243230a1c3a9f7c8c",
"reference": "c4a66b97f040e3e20b3aa2a243230a1c3a9f7c8c",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": "^7.0"
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.2.4"
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -1138,57 +1143,57 @@
"keywords": [
"tokenizer"
],
"time": "2017-11-27T05:48:46+00:00"
"time": "2019-07-08T05:24:54+00:00"
},
{
"name": "phpunit/phpunit",
"version": "6.5.14",
"version": "7.5.14",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7"
"reference": "2834789aeb9ac182ad69bfdf9ae91856a59945ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7",
"reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2834789aeb9ac182ad69bfdf9ae91856a59945ff",
"reference": "2834789aeb9ac182ad69bfdf9ae91856a59945ff",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.1",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"myclabs/deep-copy": "^1.6.1",
"phar-io/manifest": "^1.0.1",
"phar-io/version": "^1.0",
"php": "^7.0",
"myclabs/deep-copy": "^1.7",
"phar-io/manifest": "^1.0.2",
"phar-io/version": "^2.0",
"php": "^7.1",
"phpspec/prophecy": "^1.7",
"phpunit/php-code-coverage": "^5.3",
"phpunit/php-file-iterator": "^1.4.3",
"phpunit/php-code-coverage": "^6.0.7",
"phpunit/php-file-iterator": "^2.0.1",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^1.0.9",
"phpunit/phpunit-mock-objects": "^5.0.9",
"sebastian/comparator": "^2.1",
"sebastian/diff": "^2.0",
"sebastian/environment": "^3.1",
"phpunit/php-timer": "^2.1",
"sebastian/comparator": "^3.0",
"sebastian/diff": "^3.0",
"sebastian/environment": "^4.0",
"sebastian/exporter": "^3.1",
"sebastian/global-state": "^2.0",
"sebastian/object-enumerator": "^3.0.3",
"sebastian/resource-operations": "^1.0",
"sebastian/resource-operations": "^2.0",
"sebastian/version": "^2.0.1"
},
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2",
"phpunit/dbunit": "<3.0"
"phpunit/phpunit-mock-objects": "*"
},
"require-dev": {
"ext-pdo": "*"
},
"suggest": {
"ext-soap": "*",
"ext-xdebug": "*",
"phpunit/php-invoker": "^1.1"
"phpunit/php-invoker": "^2.0"
},
"bin": [
"phpunit"
@ -1196,7 +1201,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.5.x-dev"
"dev-master": "7.5-dev"
}
},
"autoload": {
@ -1222,67 +1227,7 @@
"testing",
"xunit"
],
"time": "2019-02-01T05:22:47+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "5.0.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f",
"reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.5",
"php": "^7.0",
"phpunit/php-text-template": "^1.2.1",
"sebastian/exporter": "^3.1"
},
"conflict": {
"phpunit/phpunit": "<6.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5.11"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"abandoned": true,
"time": "2018-08-09T05:50:03+00:00"
"time": "2019-07-15T06:24:08+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -1331,30 +1276,30 @@
},
{
"name": "sebastian/comparator",
"version": "2.1.3",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "34369daee48eafb2651bea869b4b15d75ccc35f9"
"reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9",
"reference": "34369daee48eafb2651bea869b4b15d75ccc35f9",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
"reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
"shasum": ""
},
"require": {
"php": "^7.0",
"sebastian/diff": "^2.0 || ^3.0",
"php": "^7.1",
"sebastian/diff": "^3.0",
"sebastian/exporter": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
"phpunit/phpunit": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -1391,32 +1336,33 @@
"compare",
"equality"
],
"time": "2018-02-01T13:46:46+00:00"
"time": "2018-07-12T15:12:46+00:00"
},
{
"name": "sebastian/diff",
"version": "2.0.1",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd"
"reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd",
"reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
"reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
"shasum": ""
},
"require": {
"php": "^7.0"
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
"phpunit/phpunit": "^7.5 || ^8.0",
"symfony/process": "^2 || ^3.3 || ^4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -1441,34 +1387,40 @@
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
"diff",
"udiff",
"unidiff",
"unified diff"
],
"time": "2017-08-03T08:09:46+00:00"
"time": "2019-02-04T06:01:07+00:00"
},
{
"name": "sebastian/environment",
"version": "3.1.0",
"version": "4.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5"
"reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5",
"reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
"reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
"shasum": ""
},
"require": {
"php": "^7.0"
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.1"
"phpunit/phpunit": "^7.5"
},
"suggest": {
"ext-posix": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
"dev-master": "4.2-dev"
}
},
"autoload": {
@ -1493,7 +1445,7 @@
"environment",
"hhvm"
],
"time": "2017-07-01T08:51:00+00:00"
"time": "2019-05-05T09:05:15+00:00"
},
{
"name": "sebastian/exporter",
@ -1760,25 +1712,25 @@
},
{
"name": "sebastian/resource-operations",
"version": "1.0.0",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
"reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
"reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
"php": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "2.0-dev"
}
},
"autoload": {
@ -1798,7 +1750,7 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28T20:34:47+00:00"
"time": "2018-10-04T04:07:39+00:00"
},
{
"name": "sebastian/version",
@ -2133,10 +2085,10 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^5.6|^7.0"
"php": ">=5.6|>=7.0"
},
"platform-dev": [],
"platform-overrides": {
"php": "7.0"
"php": "7.1"
}
}

View File

@ -7,7 +7,6 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
syntaxCheck="true"
>
<testsuites>
<testsuite name="WooCommerce Test Suite">
@ -44,6 +43,6 @@
</whitelist>
</filter>
<listeners>
<listener class="SpeedTrapListener" file="tests/includes/speed-trap-listener.php" />
<listener class="SpeedTrapListener" file="tests/includes/listener-loader.php" />
</listeners>
</phpunit>

View File

@ -6,8 +6,6 @@ fi
if [[ ${RUN_CODE_COVERAGE} == 1 ]]; then
phpdbg -qrr $HOME/.composer/vendor/bin/phpunit -d memory_limit=-1 -c phpunit.xml --coverage-clover=coverage.clover --exclude-group=timeout $@
elif [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
$HOME/.composer/vendor/bin/phpunit -c phpunit.xml $@
else
phpunit -c phpunit.xml $@
$HOME/.composer/vendor/bin/phpunit -c phpunit.xml $@
fi

View File

@ -123,23 +123,4 @@ class WC_Unit_Test_Case extends WP_HTTP_TestCase {
$message = $message ? $message : "We're all doomed!";
throw new Exception( $message, $code );
}
/**
* Backport assertNotFalse to PHPUnit 3.6.12 which only runs in PHP 5.2.
*
* @since 2.2
* @param mixed $condition The statement to evaluate as not false.
* @param string $message A message to display if the assertion fails.
*/
public static function assertNotFalse( $condition, $message = '' ) {
if ( version_compare( phpversion(), '5.3', '<' ) ) {
self::assertThat( $condition, self::logicalNot( self::isFalse() ), $message );
} else {
parent::assertNotFalse( $condition, $message );
}
}
}

View File

@ -0,0 +1,9 @@
<?php
/**
* Listener loader.
*
* @package WooCommerce\UnitTests
*/
$wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib';
require_once $wp_tests_dir . '/includes/listener-loader.php';

View File

@ -1,308 +0,0 @@
<?php
// phpcs:disable
/**
* A PHPUnit TestListener that exposes your slowest running tests by outputting
* results directly to the console.
*/
class SpeedTrapListener implements PHPUnit_Framework_TestListener {
/**
* Internal tracking for test suites.
*
* Increments as more suites are run, then decremented as they finish. All
* suites have been run when returns to 0.
*
* @var integer
*/
protected $suites = 0;
/**
* Time in milliseconds at which a test will be considered "slow" and be
* reported by this listener.
*
* @var int
*/
protected $slowThreshold;
/**
* Number of tests to report on for slowness.
*
* @var int
*/
protected $reportLength;
/**
* Collection of slow tests.
*
* @var array
*/
protected $slow = array();
/**
* Construct a new instance.
*
* @param array $options
*/
public function __construct( array $options = array() ) {
$this->loadOptions( $options );
}
/**
* An error occurred.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addError( PHPUnit_Framework_Test $test, Exception $e, $time ) {
}
/**
* A warning occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_Warning $e
* @param float $time
* @since Method available since Release 5.1.0
*/
public function addWarning( PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time ) {
}
/**
* A failure occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
*/
public function addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time ) {
}
/**
* Incomplete test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addIncompleteTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
}
/**
* Risky test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
* @since Method available since Release 4.0.0
*/
public function addRiskyTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
}
/**
* Skipped test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
}
/**
* A test started.
*
* @param PHPUnit_Framework_Test $test
*/
public function startTest( PHPUnit_Framework_Test $test ) {
}
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest( PHPUnit_Framework_Test $test, $time ) {
if ( ! $test instanceof PHPUnit_Framework_TestCase ) {
return;
}
$time = $this->toMilliseconds( $time );
$threshold = $this->getSlowThreshold( $test );
if ( $this->isSlow( $time, $threshold ) ) {
$this->addSlowTest( $test, $time );
}
}
/**
* A test suite started.
*
* @param PHPUnit_Framework_TestSuite $suite
*/
public function startTestSuite( PHPUnit_Framework_TestSuite $suite ) {
$this->suites++;
}
/**
* A test suite ended.
*
* @param PHPUnit_Framework_TestSuite $suite
*/
public function endTestSuite( PHPUnit_Framework_TestSuite $suite ) {
$this->suites--;
if ( 0 === $this->suites && $this->hasSlowTests() ) {
arsort( $this->slow ); // Sort longest running tests to the top
$this->renderHeader();
$this->renderBody();
$this->renderFooter();
}
}
/**
* Whether the given test execution time is considered slow.
*
* @param int $time Test execution time in milliseconds
* @param int $slowThreshold Test execution time at which a test should be considered slow (milliseconds)
* @return bool
*/
protected function isSlow( $time, $slowThreshold ) {
return $time >= $slowThreshold;
}
/**
* Stores a test as slow.
*
* @param PHPUnit_Framework_TestCase $test
* @param int $time Test execution time in milliseconds
*/
protected function addSlowTest( PHPUnit_Framework_TestCase $test, $time ) {
$label = $this->makeLabel( $test );
$this->slow[ $label ] = $time;
}
/**
* Whether at least one test has been considered slow.
*
* @return bool
*/
protected function hasSlowTests() {
return ! empty( $this->slow );
}
/**
* Convert PHPUnit's reported test time (microseconds) to milliseconds.
*
* @param float $time
* @return int
*/
protected function toMilliseconds( $time ) {
return (int) round( $time * 1000 );
}
/**
* Label for describing a test.
*
* @param PHPUnit_Framework_TestCase $test
* @return string
*/
protected function makeLabel( PHPUnit_Framework_TestCase $test ) {
return sprintf( '%s:%s', get_class( $test ), $test->getName() );
}
/**
* Calculate number of slow tests to report about.
*
* @return int
*/
protected function getReportLength() {
return min( count( $this->slow ), $this->reportLength );
}
/**
* Find how many slow tests occurred that won't be shown due to list length.
*
* @return int Number of hidden slow tests
*/
protected function getHiddenCount() {
$total = count( $this->slow );
$showing = $this->getReportLength( $this->slow );
$hidden = 0;
if ( $total > $showing ) {
$hidden = $total - $showing;
}
return $hidden;
}
/**
* Renders slow test report header.
*/
protected function renderHeader() {
echo sprintf( "\n\nYou should really fix these slow tests (>%sms)...\n", $this->slowThreshold );
}
/**
* Renders slow test report body.
*/
protected function renderBody() {
$slowTests = $this->slow;
$length = $this->getReportLength( $slowTests );
for ( $i = 1; $i <= $length; ++$i ) {
$label = key( $slowTests );
$time = array_shift( $slowTests );
echo sprintf( " %s. %sms to run %s\n", $i, $time, $label );
}
}
/**
* Renders slow test report footer.
*/
protected function renderFooter() {
if ( $hidden = $this->getHiddenCount( $this->slow ) ) {
echo sprintf( '...and there %s %s more above your threshold hidden from view', $hidden == 1 ? 'is' : 'are', $hidden );
}
}
/**
* Populate options into class internals.
*
* @param array $options
*/
protected function loadOptions( array $options ) {
$this->slowThreshold = isset( $options['slowThreshold'] ) ? $options['slowThreshold'] : 500;
$this->reportLength = isset( $options['reportLength'] ) ? $options['reportLength'] : 10;
}
/**
* Get slow test threshold for given test. A TestCase can override the
* suite-wide slow threshold by using the annotation @slowThreshold with
* the threshold value in milliseconds.
*
* The following test will only be considered slow when its execution time
* reaches 5000ms (5 seconds):
*
* <code>
*
* @slowThreshold 5000
* public function testLongRunningProcess() {}
* </code>
*
* @param PHPUnit_Framework_TestCase $test
* @return int
*/
protected function getSlowThreshold( PHPUnit_Framework_TestCase $test ) {
$ann = $test->getAnnotations();
return isset( $ann['method']['slowThreshold'][0] ) ? $ann['method']['slowThreshold'][0] : $this->slowThreshold;
}
}

View File

@ -96,7 +96,7 @@ class WC_Tests_Report_Sales_By_Date extends WC_Unit_Test_Case {
$data->coupons[0]->order_item_name,
'There should be a single coupon applied.'
);
$this->assertEquals( $data->coupons[0]->discount_amount, $data->total_coupons, 'Total discount amount.' );
$this->assertEquals( wc_format_decimal( $data->coupons[0]->discount_amount, '' ), $data->total_coupons, 'Total discount amount.' );
$this->assertCount( 1, $data->refund_lines, 'There was one refund granted.' );
$this->assertEquals( 7, $data->partial_refunds[0]->total_refund, 'Total refunds.' );
@ -107,16 +107,16 @@ class WC_Tests_Report_Sales_By_Date extends WC_Unit_Test_Case {
$data->orders[0]->total_shipping,
'Orders, total shipping.'
);
$this->assertEquals( $data->orders[0]->total_shipping, $data->total_shipping, 'Day shipping, total shipping.' );
$this->assertEquals( wc_format_decimal( $data->orders[0]->total_shipping, '' ), $data->total_shipping, 'Day shipping, total shipping.' );
$this->assertEquals(
$order1->get_shipping_tax() + $order2->get_shipping_tax() + $order3->get_shipping_tax(),
$data->orders[0]->total_shipping_tax,
'Orders, total shipping tax.'
);
$this->assertEquals( $data->orders[0]->total_shipping_tax, $data->total_shipping_tax, 'Day shipping tax, total shipping tax.' );
$this->assertEquals( wc_format_decimal( $data->orders[0]->total_shipping_tax, '' ), $data->total_shipping_tax, 'Day shipping tax, total shipping tax.' );
$this->assertEquals( $data->orders[0]->total_tax, $data->total_tax, 'Day tax, total tax.' );
$this->assertEquals( wc_format_decimal( $data->orders[0]->total_tax, '' ), $data->total_tax, 'Day tax, total tax.' );
$this->assertEquals(
$order1->get_total() + $order2->get_total() + $order3->get_total(),
@ -124,7 +124,7 @@ class WC_Tests_Report_Sales_By_Date extends WC_Unit_Test_Case {
'Orders, total sales.'
);
$this->assertEquals(
$data->orders[0]->total_sales - $data->total_refunds,
wc_format_decimal( $data->orders[0]->total_sales - $data->total_refunds, '' ),
$data->total_sales,
'Day sales, total sales.'
);

View File

@ -1684,11 +1684,6 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
* test_cloned_cart_session.
*/
public function test_cloned_cart_session() {
// PHP 5.2 does not include support for ReflectionProperty::setAccessible().
if ( version_compare( '5.3', PHP_VERSION, '>' ) ) {
$this->markTestSkipped( 'Test requires PHP 5.3 and above to use ReflectionProperty::setAccessible()' );
}
$cart = wc()->cart;
$new_cart = clone $cart;
@ -1883,7 +1878,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
WC()->cart->calculate_totals();
$this->assertEquals( '5.71', WC()->cart->get_subtotal() );
$this->assertEquals( '6', WC()->cart->get_total( 'edit' ) );
$this->assertEquals( '6.00', WC()->cart->get_total( 'edit' ) );
add_filter( 'woocommerce_product_get_tax_class', array( $this, 'change_tax_class_filter' ) );
add_filter( 'woocommerce_product_variation_get_tax_class', array( $this, 'change_tax_class_filter' ) );

View File

@ -1,15 +1,19 @@
<?php
/**
* Tests for WC_Order_Refund.
*
* @package WooCommerce\Tests\CRUD
*/
/**
* Meta
* @package WooCommerce\Tests\CRUD
* Tests for WC_Order_Refund.
*/
class WC_Tests_CRUD_Refunds extends WC_Unit_Test_Case {
/**
* Test: get_type
*/
function test_get_type() {
public function test_get_type() {
$object = new WC_Order_Refund();
$this->assertEquals( 'shop_order_refund', $object->get_type() );
}
@ -17,16 +21,16 @@ class WC_Tests_CRUD_Refunds extends WC_Unit_Test_Case {
/**
* Test: get_refund_amount
*/
function test_get_refund_amount() {
public function test_get_refund_amount() {
$object = new WC_Order_Refund();
$object->set_amount( 20 );
$this->assertEquals( '20.00', $object->get_amount() );
$this->assertEquals( '20', $object->get_amount() );
}
/**
* Test: get_refund_reason
*/
function test_get_refund_reason() {
public function test_get_refund_reason() {
$object = new WC_Order_Refund();
$object->set_reason( 'Customer is an idiot' );
$this->assertEquals( 'Customer is an idiot', $object->get_reason() );
@ -35,7 +39,7 @@ class WC_Tests_CRUD_Refunds extends WC_Unit_Test_Case {
/**
* Test: get_refunded_by
*/
function test_get_refunded_by() {
public function test_get_refunded_by() {
$object = new WC_Order_Refund();
$object->set_refunded_by( 1 );
$this->assertEquals( 1, $object->get_refunded_by() );
@ -44,7 +48,7 @@ class WC_Tests_CRUD_Refunds extends WC_Unit_Test_Case {
/**
* Test: get_refunded_payment
*/
function test_get_refunded_payment() {
public function test_get_refunded_payment() {
$object = new WC_Order_Refund();
$object->set_refunded_payment( true );
$this->assertEquals( true, $object->get_refunded_payment() );

View File

@ -1,8 +1,12 @@
<?php
/**
* Order coupon tests.
*
* @package WooCommerce\Tests\Orders
*/
/**
* Order coupon tests.
* @package WooCommerce\Tests\Orders
*/
class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
@ -48,7 +52,7 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
)
);
// Add order products
// Add order products.
$product_item = new WC_Order_Item_Product();
$coupon_item_1 = new WC_Order_Item_Coupon();
$coupon_item_2 = new WC_Order_Item_Coupon();
@ -144,15 +148,15 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Check it's expected.
$this->assertEquals( 'shop_order', $order->get_type() );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
// Remove the virtual coupon. Total should be 999.
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '999', $order->get_total(), $order->get_total() );
$this->assertEquals( '999.00', $order->get_total(), $order->get_total() );
// Remove the other coupon. Total should be 1000.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '1000', $order->get_total(), $order->get_total() );
$this->assertEquals( '1000.00', $order->get_total(), $order->get_total() );
// Reset.
$this->init_test();
@ -162,13 +166,13 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Check it's expected.
$this->assertEquals( 'shop_order', $order->get_type() );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
// Do the above tests in reverse.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '800', $order->get_total(), $order->get_total() );
$this->assertEquals( '800.00', $order->get_total(), $order->get_total() );
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '1000', $order->get_total(), $order->get_total() );
$this->assertEquals( '1000.00', $order->get_total(), $order->get_total() );
}
/**
@ -182,7 +186,7 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
$order_id = $this->objects['order']->get_id();
$order = wc_get_order( $order_id );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
/**
* Discount should be based on subtotal unless coupons apply sequencially.
@ -215,7 +219,7 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Remove the other coupon. Total should be 1000.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '1100', $order->get_total(), $order->get_total() );
$this->assertEquals( '1100.00', $order->get_total(), $order->get_total() );
// Reset.
$this->init_test();
@ -229,9 +233,9 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Do the above tests in reverse.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '880', $order->get_total(), $order->get_total() );
$this->assertEquals( '880.00', $order->get_total(), $order->get_total() );
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '1100', $order->get_total(), $order->get_total() );
$this->assertEquals( '1100.00', $order->get_total(), $order->get_total() );
}
/**
@ -263,15 +267,15 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Check it's expected.
$this->assertEquals( 'shop_order', $order->get_type() );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
// Remove the virtual coupon. Total should be 999.
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '999', $order->get_total(), $order->get_total() );
$this->assertEquals( '999.00', $order->get_total(), $order->get_total() );
// Remove the other coupon. Total should be 1000.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '1000', $order->get_total(), $order->get_total() );
$this->assertEquals( '1000.00', $order->get_total(), $order->get_total() );
// Reset.
$this->init_test();
@ -281,13 +285,13 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Check it's expected.
$this->assertEquals( 'shop_order', $order->get_type() );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
// Do the above tests in reverse.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '800', $order->get_total(), $order->get_total() );
$this->assertEquals( '800.00', $order->get_total(), $order->get_total() );
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '1000', $order->get_total(), $order->get_total() );
$this->assertEquals( '1000.00', $order->get_total(), $order->get_total() );
}
/**
@ -302,7 +306,7 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
$order = wc_get_order( $order_id );
$order->apply_coupon( 'test-coupon-2' );
$this->assertEquals( '599', $order->get_total(), $order->get_total() );
$this->assertEquals( '599.00', $order->get_total(), $order->get_total() );
}
/**
@ -318,15 +322,15 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Check it's expected.
$this->assertEquals( 'shop_order', $order->get_type() );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
// Remove the virtual coupon. Total should be 999.
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '999', $order->get_total(), $order->get_total() );
$this->assertEquals( '999.00', $order->get_total(), $order->get_total() );
// Remove the other coupon. Total should be 1000.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '1000', $order->get_total(), $order->get_total() );
$this->assertEquals( '1000.00', $order->get_total(), $order->get_total() );
// Reset.
$this->init_test();
@ -336,13 +340,13 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
// Check it's expected.
$this->assertEquals( 'shop_order', $order->get_type() );
$this->assertEquals( '799', $order->get_total(), $order->get_total() );
$this->assertEquals( '799.00', $order->get_total(), $order->get_total() );
// Do the above tests in reverse.
$order->remove_coupon( 'test-coupon-1' );
$this->assertEquals( '800', $order->get_total(), $order->get_total() );
$this->assertEquals( '800.00', $order->get_total(), $order->get_total() );
$order->remove_coupon( 'this-is-a-virtal-coupon' );
$this->assertEquals( '1000', $order->get_total(), $order->get_total() );
$this->assertEquals( '1000.00', $order->get_total(), $order->get_total() );
}
/**
@ -357,6 +361,6 @@ class WC_Tests_Order_Coupons extends WC_Unit_Test_Case {
$order = wc_get_order( $order_id );
$order->apply_coupon( 'test-coupon-2' );
$this->assertEquals( '599', $order->get_total(), $order->get_total() );
$this->assertEquals( '599.00', $order->get_total(), $order->get_total() );
}
}