Skip to content

Commit

Permalink
Merge pull request #392 from newfold-labs/release/2.1.6
Browse files Browse the repository at this point in the history
Release 2.1.6
  • Loading branch information
circlecube authored Jan 8, 2025
2 parents 11aecab + 9251c69 commit 207b1ce
Show file tree
Hide file tree
Showing 12 changed files with 1,336 additions and 1,585 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/cypress-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ jobs:
echo '{"wpVersion": "${{ matrix.wpVersion }}","phpVersion": "${{ matrix.phpVersion }}"}' > cypress.env.json
- name: Install WordPress
run: npx wp-env start --debug
uses: nick-fields/retry@v3
with:
timeout_minutes: 4
max_attempts: 3
command: npx wp-env start --debug

- name: Run Cypress Tests
if: ${{ github.repository != 'newfold-labs/wp-plugin-web' || github.actor == 'dependabot[bot]' }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ jobs:
run: echo '{"config":{"WP_DEBUG_DISPLAY":false},"plugins":["${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }}"]}' > .wp-env.override.json

- name: Install WordPress
run: npx @wordpress/env@latest start
uses: nick-fields/retry@v3
with:
timeout_minutes: 4
max_attempts: 3
command: npx wp-env start --debug

- name: Run Cypress Tests
if: ${{ github.repository != 'newfold-labs/wp-plugin-web' || github.actor == 'dependabot[bot]' }}
Expand Down
2 changes: 1 addition & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"core": "WordPress/WordPress#tags/6.7",
"core": "WordPress/WordPress#tags/6.7.1",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
"doctrine/inflector": "1.2.0 as 1.3.1",
"newfold-labs/wp-module-activation": "^1.0.5",
"newfold-labs/wp-module-atomic": "^1.3",
"newfold-labs/wp-module-coming-soon": "^1.3.0",
"newfold-labs/wp-module-coming-soon": "^1.3.3",
"newfold-labs/wp-module-context": "^1.0.1",
"newfold-labs/wp-module-data": "^2.6.6",
"newfold-labs/wp-module-deactivation": "^1.2.3",
"newfold-labs/wp-module-data": "^2.6.8",
"newfold-labs/wp-module-deactivation": "^1.3.0",
"newfold-labs/wp-module-features": "^1.4.2",
"newfold-labs/wp-module-loader": "^1.0.10",
"newfold-labs/wp-module-loader": "^1.0.11",
"newfold-labs/wp-module-marketplace": "^2.4.0",
"newfold-labs/wp-module-notifications": "^1.6.5",
"newfold-labs/wp-module-performance": "^2.0.1",
"newfold-labs/wp-module-notifications": "^1.6.6",
"newfold-labs/wp-module-performance": "^2.2.0",
"newfold-labs/wp-module-runtime": "^1.0.12",
"newfold-labs/wp-module-secure-passwords": "^1.1.1",
"newfold-labs/wp-module-sso": "^1.0.7",
Expand All @@ -82,6 +82,6 @@
"newfold-labs/wp-php-standards": "^1.2.4",
"roave/security-advisories": "dev-latest",
"wp-cli/i18n-command": "^2.6.2",
"wp-phpunit/wp-phpunit": "^6.7.0"
"wp-phpunit/wp-phpunit": "^6.7.1"
}
}
225 changes: 170 additions & 55 deletions composer.lock

Large diffs are not rendered by default.

59 changes: 58 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,52 @@ module.exports = defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./tests/cypress/plugins/index.js')(on, config)

const semver = require('semver');

// Ensure that the base URL is always properly set.
if (config.env && config.env.baseUrl) {
config.baseUrl = config.env.baseUrl;
}

// Ensure that we have a semantically correct WordPress version number for comparisons.
if (config.env.wpVersion) {
if (config.env.wpVersion.split('.').length !== 3) {
config.env.wpSemverVersion = `${config.env.wpVersion}.0`;
} else {
config.env.wpSemverVersion = config.env.wpVersion;
}
}

if (config.env.phpVersion) {
if (config.env.phpVersion.split('.').length !== 3) {
config.env.phpSemverVersion = `${config.env.phpVersion}.0`;
} else {
config.env.phpSemverVersion = config.env.phpVersion;
}
}

// Tests requires Woo, so exclude if not supported due to WP or PHP versions
if ( ! supportsWoo( config.env ) ) {
config.excludeSpecPattern = config.excludeSpecPattern.concat( [
'vendor/newfold-labs/wp-module-coming-soon/tests/cypress/integration/coming-soon-woo.cy.js',
] );
}

on('task', {
log(message) {
console.log(message)

return null
},
table(message) {
console.table(message)

return null
}
})

return config;
},
baseUrl: 'http://localhost:8886',
specPattern: [
Expand All @@ -46,3 +91,15 @@ module.exports = defineConfig({
retries: 1,
experimentalMemoryManagement: true,
})

// Check against plugin support at https://wordpress.org/plugins/woocommerce/
const supportsWoo = ( env ) => {
const semver = require( 'semver' );
if (
semver.satisfies( env.wpSemverVersion, '>=6.5.0' ) &&
semver.satisfies( env.phpSemverVersion, '>=7.4.0' )
) {
return true;
}
return false;
};
5 changes: 1 addition & 4 deletions inc/RestApi/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function register_routes() {
),
)
);

}

/**
Expand Down Expand Up @@ -106,6 +105,7 @@ public function update_item( $request ) {
update_option( 'auto_update_translation', $new_value );
break;
case 'disableCommentsOldPosts':
$new_value = ( $new_value ) ? 'true' : 'false';
update_option( 'close_comments_for_old_posts', $new_value );
break;
case 'closeCommentsDays':
Expand Down Expand Up @@ -188,7 +188,6 @@ public function get_current_settings() {
);

return $settings;

}

/**
Expand All @@ -200,8 +199,6 @@ public function check_permission() {
if ( ! current_user_can( 'manage_options' ) ) {
return new \WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to access this endpoint.', 'wp-plugin-web' ), array( 'status' => rest_authorization_required_code() ) );
}

return true;
}

}
Loading

0 comments on commit 207b1ce

Please sign in to comment.