Merge pull request #31169 from woocommerce/fix/unit-tests
Fix unit tests
This commit is contained in:
commit
88621c6d01
|
@ -33,6 +33,7 @@
|
|||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"vimeo/psalm": "^4.4"
|
||||
},
|
||||
"default-branch": true,
|
||||
"bin": [
|
||||
"bin/mozart"
|
||||
],
|
||||
|
@ -343,6 +344,9 @@
|
|||
"console",
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v5.3.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -1117,6 +1121,9 @@
|
|||
"utf-8",
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v5.3.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
|
@ -1146,5 +1153,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.3"
|
||||
},
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
|
|
@ -411,5 +411,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
|
|
@ -1112,16 +1112,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "3.1.3",
|
||||
"version": "3.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "6b853149eab67d4da22291d36f5b0631c0fd856e"
|
||||
"reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e",
|
||||
"reference": "6b853149eab67d4da22291d36f5b0631c0fd856e",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db",
|
||||
"reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1130,7 +1130,7 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"ext-mbstring": "*",
|
||||
"phpunit/phpunit": "^6.0"
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
@ -1177,7 +1177,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3"
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1185,7 +1185,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-30T07:47:53+00:00"
|
||||
"time": "2021-11-11T13:51:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
|
@ -1697,5 +1697,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
|
|
@ -67,6 +67,11 @@
|
|||
"po",
|
||||
"translation"
|
||||
],
|
||||
"support": {
|
||||
"email": "oom@oscarotero.com",
|
||||
"issues": "https://github.com/oscarotero/Gettext/issues",
|
||||
"source": "https://github.com/php-gettext/Gettext/tree/v4.8.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://paypal.me/oscarotero",
|
||||
|
@ -85,16 +90,16 @@
|
|||
},
|
||||
{
|
||||
"name": "gettext/languages",
|
||||
"version": "2.8.1",
|
||||
"version": "2.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-gettext/Languages.git",
|
||||
"reference": "4ad818b6341e177b7c508ec4c37e18932a7b788a"
|
||||
"reference": "ed56dd2c7f4024cc953ed180d25f02f2640e3ffa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-gettext/Languages/zipball/4ad818b6341e177b7c508ec4c37e18932a7b788a",
|
||||
"reference": "4ad818b6341e177b7c508ec4c37e18932a7b788a",
|
||||
"url": "https://api.github.com/repos/php-gettext/Languages/zipball/ed56dd2c7f4024cc953ed180d25f02f2640e3ffa",
|
||||
"reference": "ed56dd2c7f4024cc953ed180d25f02f2640e3ffa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -143,7 +148,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-gettext/Languages/issues",
|
||||
"source": "https://github.com/php-gettext/Languages/tree/2.8.1"
|
||||
"source": "https://github.com/php-gettext/Languages/tree/2.9.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -155,7 +160,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-07-14T15:03:58+00:00"
|
||||
"time": "2021-11-11T17:30:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mck89/peast",
|
||||
|
@ -619,5 +624,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
|
|
@ -36,7 +36,10 @@
|
|||
"woocommerce/woocommerce-rest-api": "dist",
|
||||
"woocommerce/woocommerce-blocks": "dist"
|
||||
},
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"platform": {
|
||||
"php": "7.0.33"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"exclude-from-classmap": [
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -71,7 +71,7 @@ class WC_Unit_Tests_Bootstrap {
|
|||
* Load PHPUnit Polyfills for the WP testing suite.
|
||||
* @see https://github.com/WordPress/wordpress-develop/pull/1563/
|
||||
*/
|
||||
define( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH', __DIR__ . '/../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php' );
|
||||
define( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH', __DIR__ . '/../../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php' );
|
||||
|
||||
// load the WP testing environment.
|
||||
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
||||
|
|
|
@ -82,7 +82,8 @@ class WC_Tests_API_Functions extends WC_Unit_Test_Case {
|
|||
*/
|
||||
public function test_wc_rest_upload_image_from_url_should_return_error_when_invalid_image_is_passed() {
|
||||
// empty file.
|
||||
if ( version_compare( get_bloginfo( 'version' ), '5.4-alpha', '>=' ) ) {
|
||||
$wp_version = get_bloginfo( 'version' );
|
||||
if ( version_compare( $wp_version, '5.4-alpha', '>=' ) ) {
|
||||
$expected_error_message = 'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini file or by post_max_size being defined as smaller than upload_max_filesize in php.ini.';
|
||||
} else {
|
||||
$expected_error_message = 'Invalid image: File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.';
|
||||
|
@ -93,7 +94,7 @@ class WC_Tests_API_Functions extends WC_Unit_Test_Case {
|
|||
$this->assertEquals( $expected_error_message, $result->get_error_message() );
|
||||
|
||||
// unsupported mime type.
|
||||
$expected_error_message = 'Invalid image: Sorry, this file type is not permitted for security reasons.';
|
||||
$expected_error_message = version_compare( $wp_version, '5.9-alpha', '>=' ) ? 'Invalid image: Sorry, you are not allowed to upload this file type.' : 'Invalid image: Sorry, this file type is not permitted for security reasons.';
|
||||
$result = wc_rest_upload_image_from_url( 'http://somedomain.com/invalid-image-2.png' );
|
||||
|
||||
$this->assertWPError( $result );
|
||||
|
|
Loading…
Reference in New Issue