Skip to content

Commit

Permalink
Update to PHPUnit 9 (#493)
Browse files Browse the repository at this point in the history
* Update phpunit

* phpunit dependency should only be require-dev

* Exclude tests from CI php version syntax check

* We only need to run sniff and jshint on the latest supported version

* Run tests on php 8.2
  • Loading branch information
angusmcleod authored Nov 15, 2023
1 parent d5d84d9 commit 8b1a7d6
Show file tree
Hide file tree
Showing 28 changed files with 1,133 additions and 711 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ jobs:
matrix:
include:
- php: '5.6'
sniff: true
- php: '7.0'
sniff: true
- php: '7.4'
- php: '8.0'
sniff: true
jshint: true
- php: '8.0'

steps:
- uses: actions/checkout@v3
Expand All @@ -32,7 +30,7 @@ jobs:

- name: Syntax Check
run: |
find -L . -name '*.php' -not -path "./vendor/*" -print0 | xargs -0 -n 1 -P 4 php -l
find -L . -name '*.php' -not -path "./vendor/*" -not -path "./tests/*" -print0 | xargs -0 -n 1 -P 4 php -l
- name: Install Composer
if: 'matrix.sniff'
Expand All @@ -44,7 +42,7 @@ jobs:
- name: WordPress Coding Standards
if: 'matrix.sniff'
run: |
vendor/bin/phpcs -p -s -v -n .
vendor/bin/phpcs -p -s -v -n . -d error_reporting=E_ALL^E_DEPRECATED
- name: JSHint
if: 'matrix.jshint'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
name: Tests on PHP ${{ matrix.php }}
strategy:
matrix:
php: ['7.4']
wordpress: ['5.1.2', 'latest']
php: ['8.2']
wordpress: ['latest']

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"WPDiscourse\\Test\\DiscourseCommentTest::test_sync_comments_handle_error_response":6,"WPDiscourse\\Test\\DiscourseCommentTest::test_get_comment_type_for_post_display_public_comments_only_when_connection_fails":6,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_response_error":6,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_response_error_legacy":6,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_scopes_invalid":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_embed_error":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_category_error":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_response_body_error":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_enqueued_post":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_updating_with_deleted_topic":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_forbidden":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_unprocessable":6,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_failed_to_connect":6,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_invalid_signature":6,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_invalid_nonce":6,"WPDiscourse\\Test\\DiscourseSSOTest::test_logout_from_discourse_failed_to_get_discourse_user":6,"WPDiscourse\\Test\\DiscourseSSOTest::test_logout_from_discourse_failed_to_logout":6,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_write":6,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_date_rotation":6,"WPDiscourse\\Test\\FileManagerTest::test_validation_uploads_creation":6,"WPDiscourse\\Test\\FileManagerTest::test_validation_logs_creation":6,"WPDiscourse\\Test\\LogViewerTest::test_log_retrieval":4,"WPDiscourse\\Test\\SSOClientTest::test_parse_request_invalid_signature":4,"WPDiscourse\\Test\\SSOClientTest::test_parse_request_get_user_failed":4,"WPDiscourse\\Test\\SSOClientTest::test_parse_request_update_user_failed":4,"WPDiscourse\\Test\\SyncDiscourseUserTest::test_update_user_unable_to_find_user":6,"WPDiscourse\\Test\\SSOClientTest::test_parse_request":4},"times":{"WPDiscourse\\Test\\DiscourseCommentFormatterTest::test_format":0.013,"WPDiscourse\\Test\\DiscourseCommentFormatterTest::test_comment_cache":0.01,"WPDiscourse\\Test\\DiscourseCommentFormatterTest::test_missing_post_meta":0.01,"WPDiscourse\\Test\\DiscourseCommentTest::test_comments_disabled":0.008,"WPDiscourse\\Test\\DiscourseCommentTest::test_sync_comments":0.012,"WPDiscourse\\Test\\DiscourseCommentTest::test_sync_comments_handle_error_response":0.015,"WPDiscourse\\Test\\DiscourseCommentTest::test_get_comment_type_for_post_display_public_comments_only":0.019,"WPDiscourse\\Test\\DiscourseCommentTest::test_get_comment_type_for_post_display_public_comments_only_when_connection_fails":0.022,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status":0.001,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_legacy":0.001,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_response_error":0.003,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_response_error_legacy":0.003,"WPDiscourse\\Test\\DiscourseConnectionTest::test_check_connection_status_scopes_invalid":0.006,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating":0.011,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_embed_error":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_category_error":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_response_body_error":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_enqueued_post":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_creating_with_direct_db_publication_flags":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_pin_topic":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_discourse_username":0.021,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_discourse_username_with_single_user_api_key":0.019,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_updating":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_updating_with_deleted_topic":0.015,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_updating_with_featured_link":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_sync_to_discourse_when_updating_with_direct_db_publication_flags":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_exclude_tags_with_exclusionary_tag":0.014,"WPDiscourse\\Test\\DiscoursePublishTest::test_exclude_tags_with_non_exclusionary_tag":0.015,"WPDiscourse\\Test\\DiscoursePublishTest::test_wpdc_publish_options":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_force_publish_allowed_property":0.014,"WPDiscourse\\Test\\DiscoursePublishTest::test_force_publish_option":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_force_publish_max_age_prevents_older_posts_from_being_published":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_wp_discourse_before_xmlrpc_publish_filter":0.013,"WPDiscourse\\Test\\DiscoursePublishTest::test_xmlrpc_publish_failure_notification":0.012,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_success":0,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_forbidden":0.004,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_unprocessable":0.004,"WPDiscourse\\Test\\DiscoursePublishTest::test_remote_post_failed_to_connect":0.003,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_no_user":0.009,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_user":0.007,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_logout":0.007,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_invalid_signature":0.01,"WPDiscourse\\Test\\DiscourseSSOTest::test_sso_parse_request_invalid_nonce":0.011,"WPDiscourse\\Test\\DiscourseSSOTest::test_logout_from_discourse":0.009,"WPDiscourse\\Test\\DiscourseSSOTest::test_logout_from_discourse_failed_to_get_discourse_user":0.011,"WPDiscourse\\Test\\DiscourseSSOTest::test_logout_from_discourse_failed_to_logout":0.011,"WPDiscourse\\Test\\FileHandlerTest::test_construct":0,"WPDiscourse\\Test\\FileHandlerTest::test_enabled":0,"WPDiscourse\\Test\\FileHandlerTest::test_not_enabled":0.001,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_create":0.001,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_write":0.003,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_multiple":0.001,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_date_rotation":0.001,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_size_limit_rotation":0.01,"WPDiscourse\\Test\\FileHandlerTest::test_log_file_number":0.001,"WPDiscourse\\Test\\FileHandlerTest::test_log_max_files":0.003,"WPDiscourse\\Test\\FileManagerTest::test_validation_uploads_creation":0.001,"WPDiscourse\\Test\\FileManagerTest::test_validation_logs_creation":0,"WPDiscourse\\Test\\FileManagerTest::test_validation_ready":0,"WPDiscourse\\Test\\FileManagerTest::test_validation_not_ready":0,"WPDiscourse\\Test\\FileManagerTest::test_validation_when_wp_uploads_not_writable":0,"WPDiscourse\\Test\\FileManagerTest::test_validation_when_folders_partially_restricted":0,"WPDiscourse\\Test\\LogViewerTest::test_file_handler_not_enabled":0.002,"WPDiscourse\\Test\\LogViewerTest::test_logs_not_enabled":0,"WPDiscourse\\Test\\LogViewerTest::test_log_retrieval":0.001,"WPDiscourse\\Test\\LoggerTest::test_create":0,"WPDiscourse\\Test\\LoggerTest::test_create_handler":0,"WPDiscourse\\Test\\LoggerTest::test_create_handler_formatter":0,"WPDiscourse\\Test\\LoggerTest::test_create_file_handler_not_enabled":0.001,"WPDiscourse\\Test\\LoggerTest::test_create_logs_not_enabled":0,"WPDiscourse\\Test\\SSOClientTest::test_parse_request":0.014,"WPDiscourse\\Test\\SSOClientTest::test_parse_request_invalid_signature":0.01,"WPDiscourse\\Test\\SSOClientTest::test_parse_request_get_user_failed":0.011,"WPDiscourse\\Test\\SSOClientTest::test_parse_request_update_user_failed":0.018,"WPDiscourse\\Test\\SyncDiscourseTopicTest::test_update_topic_content":0.01,"WPDiscourse\\Test\\SyncDiscourseTopicTest::test_update_topic_content_invalid_signature":0.009,"WPDiscourse\\Test\\SyncDiscourseUserTest::test_update_user":0.002,"WPDiscourse\\Test\\SyncDiscourseUserTest::test_update_user_using_discourse_sso_user_id":0.008,"WPDiscourse\\Test\\SyncDiscourseUserTest::test_update_user_using_email":0.008,"WPDiscourse\\Test\\SyncDiscourseUserTest::test_update_user_unable_to_find_user":0.01,"WPDiscourse\\Test\\UtilitiesTest::test_get_options":0.007,"WPDiscourse\\Test\\UtilitiesTest::test_validate":0.007,"WPDiscourse\\Test\\UtilitiesTest::test_get_discourse_categories":0.008,"WPDiscourse\\Test\\UtilitiesTest::test_get_discourse_user":0.008,"WPDiscourse\\Test\\UtilitiesTest::test_get_discourse_user_by_email":0.007,"WPDiscourse\\Test\\UtilitiesTest::test_sync_sso_record":0.008,"WPDiscourse\\Test\\UtilitiesTest::test_get_sso_params":0.005,"WPDiscourse\\Test\\UtilitiesTest::test_verify_discourse_webhook_request":0.007,"WPDiscourse\\Test\\UtilitiesTest::test_get_discourse_groups":0.007,"WPDiscourse\\Test\\UtilitiesTest::test_create_discourse_user":0.005,"WPDiscourse\\Test\\UtilitiesTest::test_add_user_to_discourse_group":0.006,"WPDiscourse\\Test\\UtilitiesTest::test_remove_user_from_discourse_group":0.006}}
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"10up/wp_mock": "0.4.2",
"phpunit/phpunit": "7.5.20",
"phpunit/php-code-coverage": "^6.1.4",
"phpunit/phpunit": "9.6",
"phpunit/php-code-coverage": "^9.2.13",
"phpcompatibility/php-compatibility": "^9.3.5",
"wp-coding-standards/wpcs": "^2.3",
"monolog/monolog": "^1.25",
"yoast/phpunit-polyfills": "^1.0.1"
"yoast/phpunit-polyfills": "^1.0.1",
"dms/phpunit-arraysubset-asserts": "^0.5.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
Loading

0 comments on commit 8b1a7d6

Please sign in to comment.