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

Fix deprecation notices on PHP 8.2 #7650

Merged
merged 7 commits into from
Aug 1, 2024
Merged

Fix deprecation notices on PHP 8.2 #7650

merged 7 commits into from
Aug 1, 2024

Conversation

m1r0
Copy link
Member

@m1r0 m1r0 commented Jul 31, 2024

Resolves #7633, #7634, #7635

Proposed Changes

  • Fix deprecation notices in the UI and when running unit tests on PHP 8.2.
  • Fix unit tests.
  • Bump the CI unit tests PHP version to 8.2.
  • Code cleanup.

Testing Instructions

  1. Use PHP 8.2.
  2. Add define( 'WP_DEBUG_DISPLAY', true ); and define( 'WP_DEBUG_LOG', true ); in wp-config.php.
  3. Test the main flow of the plugin:
    1. Create a course with lessons, modules, and a quiz.
    2. Complete the course as a student.
    3. Grade the quiz.
    4. Check the reports screen.
  4. Because I wasn't able to test all features, consider going through plugin features outside of the main flow.
  5. Check your debug.log file and make sure there are no errors related to sensei-pro. Note that there could be some related to Sensei core which will be addressed in another PR.
  6. Run the unit tests and make sure there are no deprecation messages related to sensei-lms.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@m1r0 m1r0 added this to the 4.24.2 milestone Jul 31, 2024
@m1r0 m1r0 self-assigned this Jul 31, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

@m1r0 m1r0 marked this pull request as ready for review July 31, 2024 11:55
@m1r0 m1r0 requested a review from a team July 31, 2024 11:56
Comment on lines +349 to +351
ob_start();
Sensei()->setup_wizard->render_wizard_page();
ob_end_clean();
Copy link
Member Author

@m1r0 m1r0 Jul 31, 2024

Choose a reason for hiding this comment

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

This prevents an annoying output when running the test.

Copy link
Member

Choose a reason for hiding this comment

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

Special thanks for this one 😅

}

/**
* Enqueue the global block assets, except when the user is on the admin page.
*/
public function testEnqueueBlockAssets_WhenCalledOnAdmin_NotEnqueueCourseListFilter() {
/* Arrange */

$this->markTestSkipped( 'This test requires WordPress 5.8 or higher.' );
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was waiting for a minimum supported WP version higher than 5.8, which we now have.

Significance: patch
Type: fixed

Deprecation notice on the reports screen when using PHP 8.1
Copy link
Member Author

Choose a reason for hiding this comment

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

Having one changelog for the deprecation notices might be better because there are so many.

@merkushin merkushin self-requested a review July 31, 2024 15:04
merkushin
merkushin previously approved these changes Jul 31, 2024
Copy link
Member

@merkushin merkushin left a comment

Choose a reason for hiding this comment

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

No deprecation warnings encountered 👍

Copy link

github-actions bot commented Aug 1, 2024

Test the previous changes of this PR with WordPress Playground.

@m1r0 m1r0 merged commit a13fc40 into trunk Aug 1, 2024
23 checks passed
@m1r0 m1r0 deleted the fix/deprecation-notices branch August 1, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants