Merge branch 'master' into update/woocommerce-blocks-3.6.0

This commit is contained in:
Claudio Sanches 2020-10-19 23:40:52 -03:00
commit f349a70618
24 changed files with 1039 additions and 162 deletions

View File

@ -9,7 +9,6 @@ cache:
# Since Xenial services are not started by default, we need to instruct it below to start.
services:
- xvfb
- mysql
- docker
@ -30,11 +29,13 @@ jobs:
fast_finish: true
include:
- name: "Core E2E Tests"
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_E2E=1
install:
- nvm install
- npm install
- composer install
script:
- npm run build:assets
- npm install jest --global
- npm run docker:up
- npm run test:e2e
after_script:
@ -57,6 +58,7 @@ jobs:
allow_failures:
- php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
- name: "WP Nightly"
install:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
@ -67,8 +69,6 @@ install:
else
echo "xdebug.ini does not exist"
fi
- nvm install
- npm install
- composer install
- |
# Install WP Test suite, install PHPUnit globally:
@ -76,7 +76,6 @@ install:
bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
composer global require "phpunit/phpunit=6.5.*|7.5.*"
fi
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
script:
- bash tests/bin/phpunit.sh

View File

@ -9,7 +9,7 @@
"require": {
"php": ">=7.0",
"automattic/jetpack-autoloader": "2.2.0",
"automattic/jetpack-constants": "1.4.0",
"automattic/jetpack-constants": "1.5.0",
"composer/installers": "1.7.0",
"maxmind-db/reader": "1.6.0",
"pelago/emogrifier": "3.1.0",
@ -17,7 +17,7 @@
"woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "1.6.1",
"woocommerce/woocommerce-blocks": "3.6.0",
"league/container": "3.3.1"
"league/container": "3.3.3"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4"

30
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": "cc3015cb9bc781605cedc88749cd28af",
"content-hash": "cba7b2c774868039e8dda4628b3b60aa",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -44,16 +44,16 @@
},
{
"name": "automattic/jetpack-constants",
"version": "v1.4.0",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/Automattic/jetpack-constants.git",
"reference": "b4210d56948529b43785ce31e0055f435eac1f9f"
"reference": "9827a2f446b8c4faafaf1c740483031c073a381d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/b4210d56948529b43785ce31e0055f435eac1f9f",
"reference": "b4210d56948529b43785ce31e0055f435eac1f9f",
"url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/9827a2f446b8c4faafaf1c740483031c073a381d",
"reference": "9827a2f446b8c4faafaf1c740483031c073a381d",
"shasum": ""
},
"require-dev": {
@ -71,7 +71,7 @@
"GPL-2.0-or-later"
],
"description": "A wrapper for defining constants in a more testable way.",
"time": "2020-07-01T15:55:35+00:00"
"time": "2020-08-13T14:33:09+00:00"
},
{
"name": "composer/installers",
@ -197,20 +197,20 @@
},
{
"name": "league/container",
"version": "3.3.1",
"version": "3.3.3",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/container.git",
"reference": "93238f74ff5964aee27a78508cdfbdba1cd338f6"
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/container/zipball/93238f74ff5964aee27a78508cdfbdba1cd338f6",
"reference": "93238f74ff5964aee27a78508cdfbdba1cd338f6",
"url": "https://api.github.com/repos/thephpleague/container/zipball/7dc67bdf89efc338e674863c0ea70a63efe4de05",
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05",
"shasum": ""
},
"require": {
"php": "^7.0",
"php": "^7.0 || ^8.0",
"psr/container": "^1.0"
},
"provide": {
@ -259,7 +259,13 @@
"provider",
"service"
],
"time": "2020-05-18T08:20:23+00:00"
"funding": [
{
"url": "https://github.com/philipobenito",
"type": "github"
}
],
"time": "2020-09-28T13:38:44+00:00"
},
{
"name": "maxmind-db/reader",

View File

@ -162,6 +162,15 @@ return array(
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'KE' => array(
'currency_code' => 'KES',
'currency_pos' => 'left',
'thousand_sep' => ',',
'decimal_sep' => '.',
'num_decimals' => 0,
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'KR' => array(
'currency_code' => 'KRW',
'currency_pos' => 'right',
@ -271,6 +280,24 @@ return array(
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'TZ' => array(
'currency_code' => 'TZS',
'currency_pos' => 'left',
'thousand_sep' => ',',
'decimal_sep' => '.',
'num_decimals' => 0,
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'UG' => array(
'currency_code' => 'UGX',
'currency_pos' => 'left',
'thousand_sep' => ',',
'decimal_sep' => '.',
'num_decimals' => 0,
'weight_unit' => 'kg',
'dimension_unit' => 'cm',
),
'US' => array(
'currency_code' => 'USD',
'currency_pos' => 'left',

View File

@ -387,7 +387,7 @@ class WC_Admin_Taxonomies {
* @param object $term Term object.
* @return array
*/
public function product_cat_row_actions( $actions = array(), $term ) {
public function product_cat_row_actions( $actions, $term ) {
$default_category_id = absint( get_option( 'default_product_cat', 0 ) );
if ( $default_category_id !== $term->term_id && current_user_can( 'edit_term', $term->term_id ) ) {

View File

@ -344,6 +344,8 @@ class WC_Meta_Box_Order_Data {
if ( 'billing_phone' === $field_name ) {
$field_value = wc_make_phone_clickable( $field_value );
} elseif ( 'billing_email' === $field_name ) {
$field_value = '<a href="' . esc_url( 'mailto:' . $field_value ) . '">' . $field_value . '</a>';
} else {
$field_value = make_clickable( esc_html( $field_value ) );
}

View File

@ -150,7 +150,7 @@ class WC_Shipping {
/**
* Loads all shipping methods which are hooked in.
* If a $package is passed some methods may add themselves conditionally and zones will be used.
* If a $package is passed, some methods may add themselves conditionally and zones will be used.
*
* @param array $package Package information.
* @return WC_Shipping_Method[]

View File

@ -93,7 +93,7 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element || ( 0 === $element->count && ! empty( $args[0]['hide_empty'] ) ) ) {
return;
}

View File

@ -144,7 +144,7 @@ class WC_Product_Cat_List_Walker extends Walker {
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element || ( 0 === $element->count && ! empty( $args[0]['hide_empty'] ) ) ) {
return;
}

View File

@ -2874,7 +2874,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field_html = '';
if ( $args['label'] && 'checkbox' !== $args['type'] ) {
$field_html .= '<label for="' . esc_attr( $label_id ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) . '">' . $args['label'] . $required . '</label>';
$field_html .= '<label for="' . esc_attr( $label_id ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) . '">' . wp_kses_post( $args['label'] ) . $required . '</label>';
}
$field_html .= '<span class="woocommerce-input-wrapper">' . $field;

874
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
"docker:up": "npm explore @woocommerce/e2e-environment -- npm run docker:up",
"docker:down": "npm explore @woocommerce/e2e-environment -- npm run docker:down",
"test:e2e": "npm explore @woocommerce/e2e-environment -- npm run test:e2e",
"test:e2e-debug": "npm explore @woocommerce/e2e-environment -- npm run test:e2e-debug",
"test:e2e-dev": "npm explore @woocommerce/e2e-environment -- npm run test:e2e-dev",
"makepot": "composer run-script makepot",
"packages:fix:textdomain": "node ./bin/package-update-textdomain.js",
@ -32,11 +33,11 @@
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && node ./node_modules/husky/husky.js install"
},
"devDependencies": {
"@babel/cli": "7.10.4",
"@babel/core": "7.10.4",
"@babel/polyfill": "7.10.4",
"@babel/preset-env": "7.10.4",
"@babel/register": "7.10.4",
"@babel/cli": "7.12.0",
"@babel/core": "7.12.0",
"@babel/polyfill": "7.11.5",
"@babel/preset-env": "7.12.0",
"@babel/register": "7.12.0",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/experimental-utils": "3.10.1",
"@typescript-eslint/parser": "3.10.1",
@ -53,12 +54,12 @@
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"commander": "4.1.1",
"config": "3.3.1",
"config": "3.3.2",
"cross-env": "6.0.3",
"deasync": "0.1.20",
"eslint": "6.8.0",
"eslint-config-wpcalypso": "5.0.0",
"eslint-plugin-jest": "23.19.0",
"eslint-plugin-jest": "23.20.0",
"github-contributors-list": "https://github.com/woocommerce/github-contributors-list/tarball/master",
"grunt": "1.3.0",
"grunt-contrib-clean": "2.0.0",

View File

@ -45,7 +45,7 @@ abstract class AbstractServiceProvider extends \Automattic\WooCommerce\Vendor\Le
$default_value = $argument->getDefaultValue();
$definition->addArgument( new RawArgument( $default_value ) );
} else {
$argument_class = $argument->getClass();
$argument_class = $this->get_class( $argument );
if ( is_null( $argument_class ) ) {
throw new ContainerException( "Argument '{$argument->getName()}' of class '$class_name' doesn't have a type hint or has one that doesn't specify a class." );
}
@ -61,6 +61,27 @@ abstract class AbstractServiceProvider extends \Automattic\WooCommerce\Vendor\Le
return $definition;
}
/**
* Gets the class of a parameter.
*
* This method is a replacement for ReflectionParameter::getClass,
* which is deprecated as of PHP 8.
*
* @param \ReflectionParameter $parameter The parameter to get the class for.
*
* @return \ReflectionClass|null The class of the parameter, or null if it hasn't any.
*/
private function get_class( \ReflectionParameter $parameter ) {
// TODO: Remove this 'if' block once minimum PHP version for WooCommerce is bumped to at least 7.1.
if ( version_compare( PHP_VERSION, '7.1', '<' ) ) {
return $parameter->getClass();
}
return $parameter->getType() && ! $parameter->getType()->isBuiltin()
? new \ReflectionClass( $parameter->getType()->getName() )
: null;
}
/**
* Check if a combination of class name and concrete is valid for registration.
* Also return the class injection method if the concrete is either a class name or null (then use the supplied class name).

View File

@ -17,10 +17,15 @@ Automated end-to-end tests for WooCommerce.
- [Prep work for running tests](#prep-work-for-running-tests)
- [How to run tests in headless mode](#how-to-run-tests-in-headless-mode)
- [How to run tests in non-headless mode](#how-to-run-tests-in-non-headless-mode)
- [How to run tests in debug mode](#how-to-run-tests-in-debug-mode)
- [How to run an individual test](#how-to-run-an-individual-test)
- [How to skip tests](#how-to-skip-tests)
- [How to run tests using custom WordPress, PHP and MariaDB versions](#how-to-run-tests-using-custom-wordpress,-php-and-mariadb-versions)
- [Writing tests](#writing-tests)
- [Guide for writing e2e tests](#guide-for-writing-e2e-tests)
- [Tools for writing tests](#tools-for-writing-tests)
- [Creating test structure](#creating-test-structure)
- [Writing the test](#writing-the-test)
- [Best practices](#best-practices)
- [Debugging tests](#debugging-tests)
## Pre-requisites
@ -148,8 +153,8 @@ npm run test:e2e
### How to run tests in non-headless mode
Tests are being run headless by default. However, sometimes it's useful to observe the browser while running tests. To do so, you can run tests in a non-headless (dev) mode:
Tests are run headless by default. However, sometimes it's useful to observe the browser while running tests. To do so, you can run tests in a non-headless (dev) mode:
```bash
npm run test:e2e-dev
```
@ -169,6 +174,16 @@ For example:
- `PUPPETEER_SLOWMO=10` - will run tests faster
- `PUPPETEER_SLOWMO=70` - will run tests slower
### How to run tests in debug mode
Tests are run headless by default. While writing tests it may be useful to have the debugger loaded while running a test in non-headless mode. To run tests in debug mode:
```bash
npm run test:e2e-debug
```
When all tests have been completed the debugger is left active. Control doesn't return to the command line until the debugger is closed. Otherwise, debug mode functions the same as non-headless mode.
### How to run an individual test
To run an individual test, use the direct path to the spec. For example:
@ -237,7 +252,9 @@ The full command to build the site will look as follows:
TRAVIS_MARIADB_VERSION=10.5.3 TRAVIS_PHP_VERSION=7.4.5 WP_VERSION=5.4.1 npm run docker:up
```
## Writing tests
## Guide for writing e2e tests
### Tools for writing tests
We use the following tools to write e2e tests:
@ -245,12 +262,92 @@ We use the following tools to write e2e tests:
- [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer) provides all required configuration to run tests using Puppeteer
- [expect-puppeteer](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer) assertion library for Puppeteer
Tests are kept in `tests/e2e/specs` folder.
In the WooCommerce Core repository the tests are kept in `tests/e2e/core-tests/specs/` folder. However, if you are writing tests in your own project using WooCommerce Core e2e packages, the tests should be located in `tests/e2e/specs/` folder.
The following packages are used to write tests:
- `@wordpress/e2e-test-utils` - End-To-End (E2E) test utils for WordPress. You can find the full list of utils [here](https://github.com/WordPress/gutenberg/tree/master/packages/e2e-test-utils);
- `@automattic/puppeteer-utils` - Utilities and configuration for running puppeteer against WordPress. See details in the [package's repository](https://github.com/Automattic/puppeteer-utils).
- `@automattic/puppeteer-utils` - utilities and configuration for running puppeteer against WordPress. See details in the [package's repository](https://github.com/Automattic/puppeteer-utils).
- `@woocommerce/e2e-utils` - this package contains utilities to simplify writing e2e tests specific to WooCommmerce. See details in the [package's repository](https://github.com/woocommerce/woocommerce/tree/master/tests/e2e/utils).
### Creating test structure
It is a good practice to start working on the test by identifying what needs to be tested on the higher and lower levels. For example, if you are writing a test to verify that merchant can create virtual product, the overview of the test will be as follows:
- Merchant can create virtual product
- Merchant can log in
- Merchant can create virtual product
- Merchant can verify that virtual product was created
Once you identify the structure of the test, you can move on to writing it.
### Writing the test
The structure of the test serves as a skeleton for the test itself. You can turn it into a test by using `describe()` and `it()` methods of Jest:
- [`describe()`](https://jestjs.io/docs/en/api#describename-fn) - creates a block that groups together several related tests;
- [`it()`](https://jestjs.io/docs/en/api#testname-fn-timeout) - actual method that runs the test.
Based on our example, the test skeleton would look as follows:
```
describe( 'Merchant can create virtual product', () => {
it( 'merchant can log in', async () => {
} );
it( 'merchant can create virtual product', async () => {
} );
it( 'merchant can verify that virtual product was created', async () => {
} );
} );
```
Next, you can start filling up each section with relevant functions (test building blocks). Note, that we have the `@woocommerce/e2e-utils` package where many reusable helper functions can be found for writing tests. For example, `flows.js` of `@woocommerce/e2e-utils` package contains `StoreOwnerFlow` object that has `login` method. As a result, in the test it can be used as `await StoreOwnerFlow.login();` so the first `it()` section of the test will become:
```
it( 'merchant can log in', async () => {
await StoreOwnerFlow.login();
} );
```
Moving to the next section where we need to actually create a product. You will find that we have a reusable function such as `createSimpleProduct()` in the `components.js` of `@woocommerce/e2e-utils` package. However, note that this function should not be used for this test because the way simple product is being created in this function is by using WooCommerce REST API. Because this is not how the merchant would typically create a virtual product, we would need to test it by writing actual steps for creating a product in the test.
`createSimpleProduct()` should be used in tests where you need to test something else than creating a simple product. In other words, this function exists in order to quickly fill the site with test data required for running tests. For example, if you want to write a test that will verify that shopper can place a product to the cart on the site, you can use `createSimpleProduct()` to create a product to test the cart.
Because `createSimpleProduct()` can't be used in the case of our example test, we'd need to navigate to the page where the user would usually create a product. To do that, there is `openNewProduct()` function of the `StoreOwnerFlow` object that we already used above. As a result, that part of the test will look as follows:
```
it( 'merchant can create virtual product', async () => {
await StoreOwnerFlow.openNewProduct();
} );
```
You would then continue writing the test using utilities where possible.
Make sure to utilize the functions of the `@automattic/puppeteer-utils` package where possible. For example, if you need to wait for certain element to be ready to be clicked on and then click on it, you can use `waitAndClick()` function:
```
await waitAndClick( page, '#selector' );
```
### Best practices
- It is best to keep the tests inside `describe()` block granular as it helps to debug the test if it fails. When the test is done running, you will see the result along with the breakdown of how each of the test sections performed. If one of the tests within `describe()` block fails, it will be shown as follows:
```
FAIL ../specs/front-end/front-end-my-account.test.js (9.219s)
My account page
✓ allows customer to login (2924ms)
✓ allows customer to see orders (1083ms)
x allows customer to see downloads (887ms)
✓ allows customer to see addresses (1161ms)
✓ allows customer to see account details (1066ms)
```
In the example above, you can see that `allows customer to see downloads` part of the test failed and can start looking at it right away. Without steps the test goes through being detailed, it is more difficult to debug it.
## Debugging tests

View File

@ -11,6 +11,10 @@ const {
verifyValueOfInputField
} = require( '@woocommerce/e2e-utils' );
const {
waitAndClick
} = require( '@woocommerce/e2e-environment' );
/**
* External dependencies
*/
@ -50,7 +54,7 @@ const runInitialStoreSettingsTest = () => {
await page.click('input[value="/%postname%/"]', {text: ' Post name'});
// Select "Custom base" in product permalinks section
await page.click('#woocommerce_custom_selection');
await waitAndClick( page, '#woocommerce_custom_selection' );
// Fill custom base slug to use
await expect(page).toFill('#woocommerce_permalink_structure', '/product/');

View File

@ -1,3 +1,30 @@
1.0.0 (unreleased)
# 0.16
- Initial release
## Added
- `useE2EEsLintConfig`, `useE2EBabelConfig` config functions
- support for local Jest and Puppeteer configuration with `useE2EJestConfig`, `useE2EJestPuppeteerConfig` config functions
- support for local node configuration
- support for custom port use in included container
- support for running tests against URLs without a port
- support for PHP, MariaDB & WP versions
- support for a non-plugin folder mapping (theme or project)
- support for `JEST_PUPPETEER_CONFIG` environment variable
- implement `@automattic/puppeteer-utils`
- implement `@wordpress/e2e-test-utils`
- enable test debugging with `test:e2e-debug` script
## Fixed
- support for local test configuration
- support for local Jest setup
- `docker:ssh` script works in any repo
## Changes
- removed the products and orders delete resets
- eliminated the use of docker-compose.yaml in the root of the project
# 0.15
- Initial/beta release

View File

@ -10,6 +10,7 @@ const { JEST_PUPPETEER_CONFIG } = process.env;
program
.usage( '<file ...> [options]' )
.option( '--dev', 'Development mode' )
.option( '--debug', 'Debug mode' )
.parse( process.argv );
const appPath = getAppRoot();
@ -60,7 +61,7 @@ const jestArgs = [
...program.args,
];
if ( program.dev ) {
if ( program.debug ) {
jestCommand = 'npx';
jestArgs.unshift( 'ndb', 'jest' );
}

View File

@ -21,7 +21,7 @@ do
if [[ $count -gt ${MAX_ATTEMPTS} ]]; then
echo "$(date) - Docker container couldn't be built"
exit
exit 1
fi
done

View File

@ -14,6 +14,20 @@ const {
const { getAppRoot, getTestConfig } = require( './utils' );
const webpackAlias = require( './webpack-alias' );
const {
clickAndWaitForNewPage,
getAccountCredentials,
isEventuallyPresent,
isEventuallyVisible,
logDebugLog,
logHTML,
waitAndClick,
waitAndType,
waitForSelector,
scrollIntoView,
Page
} = require( '@automattic/puppeteer-utils' );
module.exports = {
babelConfig,
esLintConfig,
@ -26,4 +40,15 @@ module.exports = {
getAppRoot,
getTestConfig,
webpackAlias,
clickAndWaitForNewPage,
getAccountCredentials,
isEventuallyPresent,
isEventuallyVisible,
logDebugLog,
logHTML,
waitAndClick,
waitAndType,
waitForSelector,
scrollIntoView,
Page,
};

10
tests/e2e/env/package-lock.json generated vendored
View File

@ -62,11 +62,6 @@
}
}
}
},
"prettier": {
"version": "npm:wp-prettier@1.19.1",
"resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-1.19.1.tgz",
"integrity": "sha512-mqAC2r1NDmRjG+z3KCJ/i61tycKlmADIjxnDhQab+KBxSAGbF/W7/zwB2guy/ypIeKrrftNsIYkNZZQKf3vJcg=="
}
}
},
@ -9824,6 +9819,11 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
"dev": true
},
"prettier": {
"version": "npm:wp-prettier@1.19.1",
"resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-1.19.1.tgz",
"integrity": "sha512-mqAC2r1NDmRjG+z3KCJ/i61tycKlmADIjxnDhQab+KBxSAGbF/W7/zwB2guy/ypIeKrrftNsIYkNZZQKf3vJcg=="
},
"prettier-linter-helpers": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/e2e-environment",
"version": "0.1.5",
"version": "0.1.6",
"description": "WooCommerce End to End Testing Environment Configuration.",
"author": "Automattic",
"license": "GPL-3.0-or-later",
@ -53,6 +53,7 @@
"docker:ssh": "docker exec -it $(node utils/get-app-name.js)_wordpress-www /bin/bash",
"install-wp-tests": "./bin/install-wp-tests.sh",
"test:e2e": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js",
"test:e2e-debug": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev --debug",
"test:e2e-dev": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/e2e-utils",
"version": "0.1.0",
"version": "0.1.1",
"description": "End-To-End (E2E) test utils for WooCommerce",
"homepage": "https://github.com/woocommerce/woocommerce/tree/master/tests/e2e-utils/README.md",
"repository": {
@ -11,7 +11,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"dependencies": {
"@woocommerce/api": "file:../api",
"@woocommerce/api": "0.1.0",
"@wordpress/e2e-test-utils": "4.6.0",
"faker": "^5.1.0",
"fishery": "^1.0.1"

View File

@ -94,7 +94,7 @@ class AbstractServiceProviderTest extends \WC_Unit_Test_Case {
*/
public function test_add_with_auto_arguments_throws_on_class_private_method_injection() {
$this->expectException( ContainerException::class );
$this->expectExceptionMessage( "Method '" . Definition::INJECTION_METHOD . "' of class '" . ClassWithPrivateInjectionMethod::class . "' isn't 'public', instances can't be created." );
$this->expectExceptionMessage( "Method '" . Definition::INJECTION_METHOD . "' of class '" . ClassWithPrivateInjectionMethod::class . "' isn't 'final public', instances can't be created." );
$this->sut->add_with_auto_arguments( ClassWithPrivateInjectionMethod::class );
}
@ -114,7 +114,7 @@ class AbstractServiceProviderTest extends \WC_Unit_Test_Case {
*/
public function test_add_with_auto_arguments_throws_on_concrete_private_method_injection() {
$this->expectException( ContainerException::class );
$this->expectExceptionMessage( "Method '" . Definition::INJECTION_METHOD . "' of class '" . ClassWithPrivateInjectionMethod::class . "' isn't 'public', instances can't be created." );
$this->expectExceptionMessage( "Method '" . Definition::INJECTION_METHOD . "' of class '" . ClassWithPrivateInjectionMethod::class . "' isn't 'final public', instances can't be created." );
$this->sut->add_with_auto_arguments( ClassWithDependencies::class, ClassWithPrivateInjectionMethod::class );
}

View File

@ -12,13 +12,15 @@ namespace Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClas
*/
class ClassWithPrivateInjectionMethod {
// phpcs:disable WooCommerce.Functions.InternalInjectionMethod.MissingPublic
// phpcs:disable WooCommerce.Functions.InternalInjectionMethod.MissingPublic, WooCommerce.Functions.InternalInjectionMethod.MissingFinal
/**
* Initialize the class instance.
*
* @internal
*/
final private function init() {
private function init() {
}
// phpcs:enable
}