Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DGR-964: Bump Tested up to version to 6.6 #73

Merged
merged 6 commits into from
Oct 3, 2024

Conversation

kei178
Copy link
Collaborator

@kei178 kei178 commented Oct 2, 2024

This PR updates the tested WP version up to 6.6. As commented, it also fixes the development and CI setup for PHPCS and corrects PHPCS violations.

I've also conducted manual testing from the UI to make sure everything works as expected.

Screenshot 2024-10-03 at 11 35 15 Screenshot 2024-10-03 at 11 35 51

@kei178 kei178 self-assigned this Oct 2, 2024
Comment on lines -36 to +44
- php: '7.0'
composer: 1
wordpress: '5.9'
wordpress: '6.2'
- php: '7.1'
composer: 1
wordpress: '5.9'
- php: '7.2'
composer: 2
wordpress: '5.9'
- php: '7.3'
composer: 2
wordpress: '5.9'
wordpress: '6.5'
- php: '7.4'
composer: 2
wordpress: '5.9'
wordpress: '6.6'
- php: '8.2'
composer: 2
wordpress: '6.6'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kei178 kei178 added the wip label Oct 2, 2024
@kei178 kei178 force-pushed the feature/DGR-964/test-with-latest-wordpress-version branch 9 times, most recently from c046f8b to 97b2e94 Compare October 3, 2024 03:02
@kei178 kei178 force-pushed the feature/DGR-964/test-with-latest-wordpress-version branch 2 times, most recently from d40057e to b079544 Compare October 3, 2024 03:46
@kei178 kei178 force-pushed the feature/DGR-964/test-with-latest-wordpress-version branch from b079544 to 590fd9c Compare October 3, 2024 03:48
Comment on lines +69 to +76
git clone -b main https://github.com/WordPress/WordPress-Coding-Standards.git vendor/wp-coding-standards/wpcs
composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require wp-coding-standards/wpcs
composer global require phpcompatibility/phpcompatibility-paragonie
composer global require phpcompatibility/phpcompatibility-wp
sudo vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp
composer global require phpcsstandards/phpcsutils
composer global require phpcsstandards/phpcsextra
sudo vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp,vendor/phpcsstandards/phpcsutils,vendor/phpcsstandards/phpcsextra
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix the PHPCS setup for CI.

Comment on lines +11 to +15
git clone -b main https://github.com/WordPress/WordPress-Coding-Standards.git $wpcs_path
phpcsutils_path="${PLUGIN_DIR}/vendor/phpcsstandards/phpcsutils"
phpcompatibility_path="${PLUGIN_DIR}/vendor/phpcompatibility/phpcompatibility-wp"
phpcs_extra_path="${PLUGIN_DIR}/vendor/phpcsstandards/phpcsextra"
vendor/bin/phpcs --config-set installed_paths $wpcs_path, $phpcsutils_path, $phpcompatibility_path, $phpcs_extra_path
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix the PHPCS setup for development.

Comment on lines +6 to +8
"phpcompatibility/phpcompatibility-wp": "*",
"phpcsstandards/phpcsutils": "^1.0",
"phpcsstandards/phpcsextra": "^1.2.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix the PHPCS setup for development.

@@ -23,7 +23,7 @@ public static function add() {
add_menu_page(
'Accredible LearnDash Add-on',
'Accredible LearnDash Add-on',
'administrator',
'manage_options',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix the following PHPCS violation.

Screenshot 2024-10-03 at 11 03 29

We need to provide not a role but a capability for the 3rd argument of add_menu_page and add_submenu_page.

c.f.

@@ -21,7 +21,7 @@ class Accredible_Learndash_Admin_Form_Helper {
public static function value_attr( $obj, $key ) {
$obj = (array) $obj;
if ( ! empty( $obj ) && isset( $obj[ $key ] ) ) {
echo sprintf(
printf(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-correction by PHPCBF: bbcfe99

@@ -93,7 +93,7 @@ public function build_table_rows( $table_data ) {
}
$row_cells .= '</tr>';

$index ++;
++$index;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-correction by PHPCBF: bbcfe99

@@ -157,10 +157,8 @@ public static function validate( $data, $id = null ) {
if ( ! isset( $data[ $field ] ) || '' === trim( $data[ $field ] ) ) {
throw new Exception( esc_attr( $field ) . ' is a required field.' );
}
} else {
if ( array_key_exists( $field, $data ) && ( null === $data[ $field ] || '' === trim( $data[ $field ] ) ) ) {
} elseif ( array_key_exists( $field, $data ) && ( null === $data[ $field ] || '' === trim( $data[ $field ] ) ) ) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-correction by PHPCBF: bbcfe99

Comment on lines +35 to +39
* @param mixed $default_value default value.
*/
public static function html( $value, $default = 'N/A' ) {
public static function html( $value, $default_value = 'N/A' ) {
if ( empty( $value ) ) {
$value = $default;
$value = $default_value;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix the following PHPCS warning:

Screenshot 2024-10-03 at 11 03 35

@kei178 kei178 removed the wip label Oct 3, 2024
Copy link

@albertpaulp albertpaulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My php foo is definitely rusted but changes look reasonable also CI & manual testing gives confidence, off to you go sailer 🚢

Copy link

@abhisheksarka abhisheksarka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love PHP 🫠

@kei178 kei178 merged commit df4f21d into develop Oct 3, 2024
4 checks passed
@kei178 kei178 deleted the feature/DGR-964/test-with-latest-wordpress-version branch October 3, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants