diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml
index 65ef3ed29..0cb7316c7 100644
--- a/.github/workflows/cypress.yml
+++ b/.github/workflows/cypress.yml
@@ -93,8 +93,8 @@ jobs:
- name: Log WP environment versions
run: |
- npx wp-env run cli "wp core version"
- npx wp-env run cli "php --version"
+ npm run env run cli -- wp core version
+ npm run env run cli -- php --version
- name: Test
run: npm run cypress:run
diff --git a/includes/classes/DistributorPost.php b/includes/classes/DistributorPost.php
index 17d1d5eb3..fef6d0c18 100644
--- a/includes/classes/DistributorPost.php
+++ b/includes/classes/DistributorPost.php
@@ -748,7 +748,11 @@ protected function parse_blocks_for_attachment_id( $block ) {
}
if ( in_array( $block['blockName'], $block_names, true ) ) {
- $media[] = $block['attrs'][ $media_blocks[ $block['blockName'] ] ];
+ $attribute_key = $media_blocks[ $block['blockName'] ];
+
+ if ( isset( $block['attrs'][ $attribute_key ] ) ) {
+ $media[] = $block['attrs'][ $attribute_key ];
+ }
}
return $media;
diff --git a/includes/classes/PullListTable.php b/includes/classes/PullListTable.php
index 531d6f408..759afe833 100644
--- a/includes/classes/PullListTable.php
+++ b/includes/classes/PullListTable.php
@@ -437,19 +437,14 @@ public function prepare_items() {
/** Process bulk action */
$this->process_bulk_action();
- $per_page = $this->get_items_per_page( 'pull_posts_per_page', get_option( 'posts_per_page' ) );
-
+ $per_page = $this->get_items_per_page( 'pull_posts_per_page', get_option( 'posts_per_page' ) );
$current_page = $this->get_pagenum();
// Support 'View all' filtering for internal connections.
- if ( is_a( $connection_now, '\Distributor\InternalConnections\NetworkSiteConnection' ) ) {
- if ( empty( $connection_now->pull_post_type ) || 'all' === $connection_now->pull_post_type ) {
- $post_type = wp_list_pluck( $connection_now->pull_post_types, 'slug' );
- } else {
- $post_type = $connection_now->pull_post_type;
- }
+ if ( empty( $connection_now->pull_post_type ) || 'all' === $connection_now->pull_post_type ) {
+ $post_type = wp_list_pluck( $connection_now->pull_post_types, 'slug' );
} else {
- $post_type = $connection_now->pull_post_type ? $connection_now->pull_post_type : 'post';
+ $post_type = $connection_now->pull_post_type;
}
$remote_get_args = [
@@ -527,18 +522,23 @@ public function prepare_items() {
$remote_get_args['paged'] = 1;
}
+ if ( ! is_array( $remote_get_args['post_type'] ) ) {
+ $remote_get_args['post_type'] = [ $remote_get_args['post_type'] ];
+ }
+
+ $total_items = 0;
+ $response_data = array();
+
+ // Setup remote connection from the connection object.
$remote_get = $connection_now->remote_get( $remote_get_args );
+ // Check and throw error if there is one.
if ( is_wp_error( $remote_get ) ) {
$this->pull_error = $remote_get->get_error_messages();
-
- return;
}
- // Get total items retrieved from the remote request if not already set.
- if ( false === $total_items ) {
- $total_items = $remote_get['total_items'];
- }
+ $total_items = $remote_get['total_items'];
+ $response_data = array_merge( $response_data, array_values( $remote_get['items'] ) );
$this->set_pagination_args(
[
@@ -547,7 +547,7 @@ public function prepare_items() {
]
);
- foreach ( $remote_get['items'] as $item ) {
+ foreach ( $response_data as $item ) {
$this->items[] = $item;
}
}
@@ -612,17 +612,15 @@ public function extra_tablenav( $which ) {
$connection_type = 'external';
}
- if ( $connection_now && $connection_now->pull_post_types && $connection_now->pull_post_type ) :
+ if ( $connection_now && $connection_now->pull_post_types ) :
?>
pull_post_type = '';
$connection_now->pull_post_types = \Distributor\Utils\available_pull_post_types( $connection_now, $connection_type );
// Ensure we have at least one post type to pull.
$connection_now->pull_post_type = '';
if ( ! empty( $connection_now->pull_post_types ) ) {
- $connection_now->pull_post_type = ( 'internal' === $connection_type ) ? 'all' : $connection_now->pull_post_types[0]['slug'];
+ $connection_now->pull_post_type = 'all';
}
// Set the post type we want to pull (if any)
// This is either from a query param, "post" post type, or the first in the list
foreach ( $connection_now->pull_post_types as $post_type ) {
- if ( isset( $_GET['pull_post_type'] ) ) { // @codingStandardsIgnoreLine No nonce needed here.
- if ( $_GET['pull_post_type'] === $post_type['slug'] ) { // @codingStandardsIgnoreLine Comparing values, no nonce needed.
- $connection_now->pull_post_type = $post_type['slug'];
+ if ( ! empty( $_GET['pull_post_type'] ) ) {
+ if ( 'all' === $_GET['pull_post_type'] ) {
+ $connection_now->pull_post_type = 'all';
break;
- }
- } else {
- if ( 'post' === $post_type['slug'] && 'external' === $connection_type ) {
+ } elseif ( $_GET['pull_post_type'] === $post_type['slug'] ) {
$connection_now->pull_post_type = $post_type['slug'];
break;
}
+ } else {
+ $connection_now->pull_post_type = ! empty( $post_type['slug'] ) ? $post_type['slug'] : 'all';
+ break;
}
}
?>
diff --git a/includes/rest-api.php b/includes/rest-api.php
index 41dceed42..cf7d914b1 100644
--- a/includes/rest-api.php
+++ b/includes/rest-api.php
@@ -586,12 +586,7 @@ function distributor_meta() {
* Check user permissions for available post types
*/
function check_post_types_permissions() {
- $types = get_post_types(
- array(
- 'show_in_rest' => true,
- ),
- 'objects'
- );
+ $types = Utils\distributable_post_types( 'objects' );
$response = array(
'can_get' => array(),
@@ -623,10 +618,11 @@ function check_post_types_permissions() {
* @return \WP_REST_Response|\WP_Error
*/
function get_pull_content_list( $request ) {
- $args = [
+ $post_type = ! empty( $request['post_type'] ) ? $request['post_type'] : array( 'post' );
+ $args = [
'posts_per_page' => isset( $request['posts_per_page'] ) ? $request['posts_per_page'] : 20,
'paged' => isset( $request['page'] ) ? $request['page'] : 1,
- 'post_type' => isset( $request['post_type'] ) ? $request['post_type'] : 'post',
+ 'post_type' => $post_type,
'post_status' => isset( $request['post_status'] ) ? $request['post_status'] : array( 'any' ),
'order' => ! empty( $request['order'] ) ? strtoupper( $request['order'] ) : 'DESC',
];
diff --git a/includes/utils.php b/includes/utils.php
index 1e53a57f9..607a07985 100644
--- a/includes/utils.php
+++ b/includes/utils.php
@@ -434,7 +434,13 @@ function excluded_meta() {
*/
function prepare_meta( $post_id ) {
update_postmeta_cache( array( $post_id ) );
- $meta = get_post_meta( $post_id );
+ $meta = get_post_meta( $post_id );
+
+ if ( false === $meta ) {
+ return array();
+ }
+
+ $meta = is_array( $meta ) ? $meta : array();
$prepared_meta = array();
$excluded_meta = excluded_meta();
diff --git a/package-lock.json b/package-lock.json
index da29685bc..9e4adc5ec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,8 +12,8 @@
"mustache": "^4.2.0"
},
"devDependencies": {
- "@10up/cypress-wp-utils": "^0.2.0",
- "@wordpress/env": "^10.1.0",
+ "@10up/cypress-wp-utils": "^0.4.0",
+ "@wordpress/env": "^10.2.0",
"@wordpress/scripts": "^26.19.0",
"compare-versions": "^4.1.3",
"cypress": "^13.1.0",
@@ -30,9 +30,9 @@
}
},
"node_modules/@10up/cypress-wp-utils": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/@10up/cypress-wp-utils/-/cypress-wp-utils-0.2.0.tgz",
- "integrity": "sha512-5gzamtHIFojT+wx0OzSAEeVY6FVrlcVPHVFH23uExkaqQhNsJvrnpdtqtT98wAYkXg56c1qDN7Ju7ZRTaNzP5g==",
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/@10up/cypress-wp-utils/-/cypress-wp-utils-0.4.0.tgz",
+ "integrity": "sha512-7cNELIX6ml5V9JEU83iEyQ6dkZ77ImdR5HKjUP4oyArQogPVcFPUnokU7GInH8DicqXbESrrkxZ0IfnNtNWh+A==",
"dev": true,
"engines": {
"node": ">=12.0"
@@ -4814,9 +4814,9 @@
}
},
"node_modules/@wordpress/env": {
- "version": "10.1.0",
- "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.1.0.tgz",
- "integrity": "sha512-kctjcTTWlQlG2IjjQGTLK/1Z6P4pl2W7Z34gbOR0eouqHlfJ7lJ44HXsHKUbNwIPzU7a/iLCT/N1B1b0TNu66Q==",
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.2.0.tgz",
+ "integrity": "sha512-EToZYPGXpl42Asw3bxpX8aKmHfRUdGxKPjQ9CHZVQoTAL27Af4FyjyGnepsnDpnYdIeI8VPb2S3k2NL/1+fpIA==",
"dev": true,
"dependencies": {
"chalk": "^4.0.0",
@@ -6195,12 +6195,12 @@
}
},
"node_modules/braces": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
- "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"dependencies": {
- "fill-range": "^7.0.1"
+ "fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
@@ -10183,9 +10183,9 @@
}
},
"node_modules/fill-range": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
- "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
@@ -11525,10 +11525,29 @@
"deprecated": "We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser",
"dev": true
},
- "node_modules/ip": {
- "version": "1.1.9",
- "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz",
- "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==",
+ "node_modules/ip-address": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
+ "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
+ "dev": true,
+ "dependencies": {
+ "jsbn": "1.1.0",
+ "sprintf-js": "^1.1.3"
+ },
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/ip-address/node_modules/jsbn": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
+ "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
+ "dev": true
+ },
+ "node_modules/ip-address/node_modules/sprintf-js": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
+ "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"dev": true
},
"node_modules/ipaddr.js": {
@@ -13603,9 +13622,9 @@
}
},
"node_modules/lighthouse/node_modules/ws": {
- "version": "7.5.9",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
- "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
+ "version": "7.5.10",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
+ "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"dev": true,
"engines": {
"node": ">=8.3.0"
@@ -15881,13 +15900,12 @@
}
},
"node_modules/pac-resolver": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz",
- "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==",
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz",
+ "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==",
"dev": true,
"dependencies": {
"degenerator": "^5.0.0",
- "ip": "^1.1.8",
"netmask": "^2.0.2"
},
"engines": {
@@ -18522,16 +18540,16 @@
}
},
"node_modules/socks": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
- "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
+ "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"dev": true,
"dependencies": {
- "ip": "^2.0.0",
+ "ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
},
"engines": {
- "node": ">= 10.13.0",
+ "node": ">= 10.0.0",
"npm": ">= 3.0.0"
}
},
@@ -18561,12 +18579,6 @@
"node": ">= 14"
}
},
- "node_modules/socks/node_modules/ip": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
- "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==",
- "dev": true
- },
"node_modules/source-map": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
@@ -20462,9 +20474,9 @@
}
},
"node_modules/webpack-bundle-analyzer/node_modules/ws": {
- "version": "7.5.9",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
- "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
+ "version": "7.5.10",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
+ "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"dev": true,
"engines": {
"node": ">=8.3.0"
@@ -21078,9 +21090,9 @@
}
},
"node_modules/ws": {
- "version": "8.16.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
- "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
+ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"dev": true,
"engines": {
"node": ">=10.0.0"
@@ -21279,9 +21291,9 @@
},
"dependencies": {
"@10up/cypress-wp-utils": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/@10up/cypress-wp-utils/-/cypress-wp-utils-0.2.0.tgz",
- "integrity": "sha512-5gzamtHIFojT+wx0OzSAEeVY6FVrlcVPHVFH23uExkaqQhNsJvrnpdtqtT98wAYkXg56c1qDN7Ju7ZRTaNzP5g==",
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/@10up/cypress-wp-utils/-/cypress-wp-utils-0.4.0.tgz",
+ "integrity": "sha512-7cNELIX6ml5V9JEU83iEyQ6dkZ77ImdR5HKjUP4oyArQogPVcFPUnokU7GInH8DicqXbESrrkxZ0IfnNtNWh+A==",
"dev": true
},
"@ampproject/remapping": {
@@ -24848,9 +24860,9 @@
}
},
"@wordpress/env": {
- "version": "10.1.0",
- "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.1.0.tgz",
- "integrity": "sha512-kctjcTTWlQlG2IjjQGTLK/1Z6P4pl2W7Z34gbOR0eouqHlfJ7lJ44HXsHKUbNwIPzU7a/iLCT/N1B1b0TNu66Q==",
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.2.0.tgz",
+ "integrity": "sha512-EToZYPGXpl42Asw3bxpX8aKmHfRUdGxKPjQ9CHZVQoTAL27Af4FyjyGnepsnDpnYdIeI8VPb2S3k2NL/1+fpIA==",
"dev": true,
"requires": {
"chalk": "^4.0.0",
@@ -25873,12 +25885,12 @@
}
},
"braces": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
- "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"requires": {
- "fill-range": "^7.0.1"
+ "fill-range": "^7.1.1"
}
},
"browser-stdout": {
@@ -28852,9 +28864,9 @@
}
},
"fill-range": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
- "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
@@ -29843,11 +29855,29 @@
"integrity": "sha512-IMSCKVf0USrM/959vj3xac7s8f87sc+80Y/ipBzdKy4ifBv5Gsj2tZ41EAaURVg01QU71fYr77uA8Meh6kELbg==",
"dev": true
},
- "ip": {
- "version": "1.1.9",
- "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz",
- "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==",
- "dev": true
+ "ip-address": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
+ "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
+ "dev": true,
+ "requires": {
+ "jsbn": "1.1.0",
+ "sprintf-js": "^1.1.3"
+ },
+ "dependencies": {
+ "jsbn": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
+ "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
+ "dev": true
+ },
+ "sprintf-js": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
+ "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
+ "dev": true
+ }
+ }
},
"ipaddr.js": {
"version": "2.1.0",
@@ -31368,9 +31398,9 @@
}
},
"ws": {
- "version": "7.5.9",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
- "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
+ "version": "7.5.10",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
+ "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"dev": true,
"requires": {}
},
@@ -33151,13 +33181,12 @@
}
},
"pac-resolver": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz",
- "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==",
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz",
+ "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==",
"dev": true,
"requires": {
"degenerator": "^5.0.0",
- "ip": "^1.1.8",
"netmask": "^2.0.2"
}
},
@@ -35058,21 +35087,13 @@
}
},
"socks": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
- "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
+ "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"dev": true,
"requires": {
- "ip": "^2.0.0",
+ "ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
- },
- "dependencies": {
- "ip": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
- "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==",
- "dev": true
- }
}
},
"socks-proxy-agent": {
@@ -36581,9 +36602,9 @@
"dev": true
},
"ws": {
- "version": "7.5.9",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
- "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
+ "version": "7.5.10",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
+ "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"dev": true,
"requires": {}
}
@@ -37027,9 +37048,9 @@
}
},
"ws": {
- "version": "8.16.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
- "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
+ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"dev": true,
"requires": {}
},
diff --git a/package.json b/package.json
index c66efaa2a..6480676b1 100644
--- a/package.json
+++ b/package.json
@@ -25,8 +25,8 @@
"mustache": "^4.2.0"
},
"devDependencies": {
- "@10up/cypress-wp-utils": "^0.2.0",
- "@wordpress/env": "^10.1.0",
+ "@10up/cypress-wp-utils": "^0.4.0",
+ "@wordpress/env": "^10.2.0",
"@wordpress/scripts": "^26.19.0",
"compare-versions": "^4.1.3",
"cypress": "^13.1.0",
@@ -61,8 +61,8 @@
"env:start": "wp-env start",
"env:stop": "wp-env stop",
"env:destroy": "wp-env destroy",
- "to-multisite": "wp-env run tests-cli \"wp core multisite-convert --title='Distributor Multisite'\"",
- "copy-htaccess": "wp-env run tests-cli \"cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess\"",
+ "to-multisite": "wp-env run tests-cli wp core multisite-convert --title='Distributor Multisite'",
+ "copy-htaccess": "wp-env run tests-cli cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess",
"postenv:start": "./tests/bin/initialize.sh"
},
"files": [
diff --git a/tests/cypress/config.js b/tests/cypress/config.js
index 103de3a39..1d34e7abf 100644
--- a/tests/cypress/config.js
+++ b/tests/cypress/config.js
@@ -1,5 +1,6 @@
const { defineConfig } = require( 'cypress' );
-const { readConfig } = require( '@wordpress/env/lib/config' );
+const { loadConfig } = require( '@wordpress/env/lib/config' );
+const getCacheDirectory = require( '@wordpress/env/lib/config/get-cache-directory' );
module.exports = defineConfig( {
chromeWebSecurity: false,
@@ -34,7 +35,8 @@ module.exports = defineConfig( {
* @return {Object} Updated Cypress Config object.
*/
const setBaseUrl = async ( on, config ) => {
- const wpEnvConfig = await readConfig( 'wp-env' );
+ const cacheDirectory = await getCacheDirectory();
+ const wpEnvConfig = await loadConfig( cacheDirectory );
if ( wpEnvConfig ) {
const port = wpEnvConfig.env.tests.port || null;
diff --git a/tests/cypress/e2e/internal-push.test.js b/tests/cypress/e2e/internal-push.test.js
index b3169fdd6..f882203b8 100644
--- a/tests/cypress/e2e/internal-push.test.js
+++ b/tests/cypress/e2e/internal-push.test.js
@@ -48,8 +48,10 @@ describe( 'Internal Push', () => {
cy.createPost( { title: postTitle, content } ).then( ( post ) => {
// Set category and tag
- cy.wpCli( `post term set ${ post.id } category ${ categoryName }` );
- cy.wpCli( `post term set ${ post.id } post_tag ${ tagName }` );
+ cy.wpCli(
+ `wp post term set ${ post.id } category ${ categoryName }`
+ );
+ cy.wpCli( `wp post term set ${ post.id } post_tag ${ tagName }` );
// Set post meta.
cy.wpCli(