diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2cdf311..be2a25c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,7 @@ jobs: # If testing older WordPress versions, ensure they are e.g. 5.7.4, 5.6.6 that have the X3 SSL fix: https://core.trac.wordpress.org/ticket/54207 # For PHP, make sure that an nginx configuration file exists for the required PHP version in this repository at tests/nginx/php-x.x.conf strategy: + fail-fast: false matrix: wp-versions: [ 'latest' ] #[ '6.1.1', 'latest' ] php-versions: [ '7.4', '8.0', '8.1', '8.2' ] #[ '7.4', '8.0', '8.1' ] @@ -82,14 +83,6 @@ jobs: with: path: ${{ env.PLUGIN_DIR }} - # This step is deliberate, to force PHP 7.4 for WP-CLI to work. - # PHP 8.x results in the workflow failing due to incompatibilities between WP-CLI and PHP 8.x. - - name: Install PHP 7.4.26 - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4.26 - coverage: xdebug - # We install WP-CLI, as it provides useful commands to setup and install WordPress through the command line. - name: Install WP-CLI run: | @@ -117,9 +110,9 @@ jobs: run: wp-cli plugin install ${{ secrets.CONVERTKIT_PAID_PLUGIN_URLS }} # WP_DEBUG = true is required so all PHP errors are output and caught by tests (E_ALL). - # WP_DEBUG = false for PHP 8.1, 8.2, otherwise E_DEPRECATED is output due to https://core.trac.wordpress.org/ticket/54504 + # WP_DEBUG = false for PHP 8.2, otherwise E_DEPRECATED is output due to Gravity Forms. - name: Enable WP_DEBUG - if: ${{ matrix.php-versions != '8.1' && matrix.php-versions != '8.2' }} + if: ${{ matrix.php-versions != '8.2' }} working-directory: ${{ env.ROOT_DIR }} run: | wp-cli config set WP_DEBUG true --raw diff --git a/composer.json b/composer.json index cf4d8db..da5d631 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,11 @@ "codeception/module-filesystem": "^1.0", "codeception/module-cli": "^1.0", "codeception/util-universalframework": "^1.0", + "php-webdriver/webdriver": "<=1.14.0", "wp-coding-standards/wpcs": "^3.0.0", "phpstan/phpstan": "^1.7", - "szepeviktor/phpstan-wordpress": "^1.0" + "szepeviktor/phpstan-wordpress": "^1.0", + "wp-cli/wp-cli": "2.8.1" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/tests/_data/dump.sql b/tests/_data/dump.sql index a56e35c..7653419 100644 --- a/tests/_data/dump.sql +++ b/tests/_data/dump.sql @@ -124,7 +124,7 @@ INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload` (43, 'html_type', 'text/html', 'yes'), (44, 'use_trackback', '0', 'yes'), (45, 'default_role', 'subscriber', 'yes'), -(46, 'db_version', '55853', 'yes'), +(46, 'db_version', '56657', 'yes'), (47, 'uploads_use_yearmonth_folders', '1', 'yes'), (48, 'upload_path', '', 'yes'), (49, 'blog_public', '1', 'yes'), @@ -167,9 +167,9 @@ INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload` (86, 'site_icon', '0', 'yes'), (87, 'medium_large_size_w', '768', 'yes'), (88, 'medium_large_size_h', '0', 'yes'), -(89, 'wp_page_for_privacy_policy', '', 'yes'), +(89, 'wp_page_for_privacy_policy', '3', 'yes'), (90, 'show_comments_cookies_opt_in', '1', 'yes'), -(91, 'admin_email_lifespan', '1703943492', 'yes'), +(91, 'admin_email_lifespan', '1712414097', 'yes'), (92, 'disallowed_keys', '', 'no'), (93, 'comment_previously_approved', '1', 'yes'), (94, 'auto_plugin_theme_update_emails', 'a:0:{}', 'no'), @@ -177,13 +177,13 @@ INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload` (96, 'auto_update_core_minor', 'enabled', 'yes'), (97, 'auto_update_core_major', 'enabled', 'yes'), (98, 'wp_force_deactivated_plugins', 'a:0:{}', 'yes'), -(99, 'initial_db_version', '53496', 'yes'), +(99, 'initial_db_version', '55853', 'yes'), (100, 'wp_user_roles', 'a:5:{s:13:\"administrator\";a:2:{s:4:\"name\";s:13:\"Administrator\";s:12:\"capabilities\";a:61:{s:13:\"switch_themes\";b:1;s:11:\"edit_themes\";b:1;s:16:\"activate_plugins\";b:1;s:12:\"edit_plugins\";b:1;s:10:\"edit_users\";b:1;s:10:\"edit_files\";b:1;s:14:\"manage_options\";b:1;s:17:\"moderate_comments\";b:1;s:17:\"manage_categories\";b:1;s:12:\"manage_links\";b:1;s:12:\"upload_files\";b:1;s:6:\"import\";b:1;s:15:\"unfiltered_html\";b:1;s:10:\"edit_posts\";b:1;s:17:\"edit_others_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:10:\"edit_pages\";b:1;s:4:\"read\";b:1;s:8:\"level_10\";b:1;s:7:\"level_9\";b:1;s:7:\"level_8\";b:1;s:7:\"level_7\";b:1;s:7:\"level_6\";b:1;s:7:\"level_5\";b:1;s:7:\"level_4\";b:1;s:7:\"level_3\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:17:\"edit_others_pages\";b:1;s:20:\"edit_published_pages\";b:1;s:13:\"publish_pages\";b:1;s:12:\"delete_pages\";b:1;s:19:\"delete_others_pages\";b:1;s:22:\"delete_published_pages\";b:1;s:12:\"delete_posts\";b:1;s:19:\"delete_others_posts\";b:1;s:22:\"delete_published_posts\";b:1;s:20:\"delete_private_posts\";b:1;s:18:\"edit_private_posts\";b:1;s:18:\"read_private_posts\";b:1;s:20:\"delete_private_pages\";b:1;s:18:\"edit_private_pages\";b:1;s:18:\"read_private_pages\";b:1;s:12:\"delete_users\";b:1;s:12:\"create_users\";b:1;s:17:\"unfiltered_upload\";b:1;s:14:\"edit_dashboard\";b:1;s:14:\"update_plugins\";b:1;s:14:\"delete_plugins\";b:1;s:15:\"install_plugins\";b:1;s:13:\"update_themes\";b:1;s:14:\"install_themes\";b:1;s:11:\"update_core\";b:1;s:10:\"list_users\";b:1;s:12:\"remove_users\";b:1;s:13:\"promote_users\";b:1;s:18:\"edit_theme_options\";b:1;s:13:\"delete_themes\";b:1;s:6:\"export\";b:1;}}s:6:\"editor\";a:2:{s:4:\"name\";s:6:\"Editor\";s:12:\"capabilities\";a:34:{s:17:\"moderate_comments\";b:1;s:17:\"manage_categories\";b:1;s:12:\"manage_links\";b:1;s:12:\"upload_files\";b:1;s:15:\"unfiltered_html\";b:1;s:10:\"edit_posts\";b:1;s:17:\"edit_others_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:10:\"edit_pages\";b:1;s:4:\"read\";b:1;s:7:\"level_7\";b:1;s:7:\"level_6\";b:1;s:7:\"level_5\";b:1;s:7:\"level_4\";b:1;s:7:\"level_3\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:17:\"edit_others_pages\";b:1;s:20:\"edit_published_pages\";b:1;s:13:\"publish_pages\";b:1;s:12:\"delete_pages\";b:1;s:19:\"delete_others_pages\";b:1;s:22:\"delete_published_pages\";b:1;s:12:\"delete_posts\";b:1;s:19:\"delete_others_posts\";b:1;s:22:\"delete_published_posts\";b:1;s:20:\"delete_private_posts\";b:1;s:18:\"edit_private_posts\";b:1;s:18:\"read_private_posts\";b:1;s:20:\"delete_private_pages\";b:1;s:18:\"edit_private_pages\";b:1;s:18:\"read_private_pages\";b:1;}}s:6:\"author\";a:2:{s:4:\"name\";s:6:\"Author\";s:12:\"capabilities\";a:10:{s:12:\"upload_files\";b:1;s:10:\"edit_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:4:\"read\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:12:\"delete_posts\";b:1;s:22:\"delete_published_posts\";b:1;}}s:11:\"contributor\";a:2:{s:4:\"name\";s:11:\"Contributor\";s:12:\"capabilities\";a:5:{s:10:\"edit_posts\";b:1;s:4:\"read\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:12:\"delete_posts\";b:1;}}s:10:\"subscriber\";a:2:{s:4:\"name\";s:10:\"Subscriber\";s:12:\"capabilities\";a:2:{s:4:\"read\";b:1;s:7:\"level_0\";b:1;}}}', 'yes'), (101, 'fresh_site', '1', 'yes'), (102, 'user_count', '1', 'no'), (103, 'widget_block', 'a:6:{i:2;a:1:{s:7:\"content\";s:19:\"\";}i:3;a:1:{s:7:\"content\";s:154:\"

Recent Posts

\";}i:4;a:1:{s:7:\"content\";s:227:\"

Recent Comments

\";}i:5;a:1:{s:7:\"content\";s:146:\"

Archives

\";}i:6;a:1:{s:7:\"content\";s:150:\"

Categories

\";}s:12:\"_multiwidget\";i:1;}', 'yes'), (104, 'sidebars_widgets', 'a:4:{s:19:\"wp_inactive_widgets\";a:0:{}s:9:\"sidebar-1\";a:3:{i:0;s:7:\"block-2\";i:1;s:7:\"block-3\";i:2;s:7:\"block-4\";}s:9:\"sidebar-2\";a:2:{i:0;s:7:\"block-5\";i:1;s:7:\"block-6\";}s:13:\"array_version\";i:3;}', 'yes'), -(105, 'cron', 'a:7:{i:1688395092;a:1:{s:34:\"wp_privacy_delete_old_export_files\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1688434692;a:4:{s:18:\"wp_https_detection\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_update_themes\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1688434698;a:1:{s:21:\"wp_update_user_counts\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1688477892;a:2:{s:30:\"wp_site_health_scheduled_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"weekly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:604800;}}s:32:\"recovery_mode_clean_expired_keys\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1688477898;a:2:{s:19:\"wp_scheduled_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}s:25:\"delete_expired_transients\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1688477899;a:1:{s:30:\"wp_scheduled_auto_draft_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}s:7:\"version\";i:2;}', 'yes'), +(105, 'cron', 'a:9:{i:1696862175;a:1:{s:28:\"wp_update_comment_type_batch\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1696865698;a:1:{s:34:\"wp_privacy_delete_old_export_files\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1696905298;a:3:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_update_themes\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1696905315;a:1:{s:21:\"wp_update_user_counts\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1696948498;a:2:{s:30:\"wp_site_health_scheduled_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"weekly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:604800;}}s:32:\"recovery_mode_clean_expired_keys\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1696948515;a:2:{s:19:\"wp_scheduled_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}s:25:\"delete_expired_transients\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1696948516;a:1:{s:30:\"wp_scheduled_auto_draft_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1697466926;a:1:{s:30:\"wp_delete_temp_updater_backups\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"weekly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:604800;}}}s:7:\"version\";i:2;}', 'yes'), (106, 'widget_pages', 'a:1:{s:12:\"_multiwidget\";i:1;}', 'yes'), (107, 'widget_calendar', 'a:1:{s:12:\"_multiwidget\";i:1;}', 'yes'), (108, 'widget_archives', 'a:1:{s:12:\"_multiwidget\";i:1;}', 'yes'), @@ -359,6 +359,4 @@ CREATE TABLE `wp_users` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES -(1, 'admin', '$P$BPKHO1xSCwu6j57sJB/p7JndeBdRVd.', 'admin', 'dev-email@flywheel.local', 'http://convertkit.local', '2023-07-03 13:38:12', '', 0, 'admin'); - --- 2023-02-17 12:37:57 \ No newline at end of file +(1, 'admin', '$P$BPKHO1xSCwu6j57sJB/p7JndeBdRVd.', 'admin', 'dev-email@flywheel.local', 'http://convertkit.local', '2023-07-03 13:38:12', '', 0, 'admin'); \ No newline at end of file diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml index ccf9437..20a7271 100644 --- a/tests/acceptance.suite.yml +++ b/tests/acceptance.suite.yml @@ -5,11 +5,14 @@ # Use WPDb to set up your initial database fixture. # If you need both WPWebDriver and WPBrowser tests - create a separate suite. +# Remember to call `vendor/bin/codecept build` after editing this file. + actor: AcceptanceTester modules: enabled: # wp-browser supplied classes, which provide WordPress specific functions - WPDb + - WPFilesystem - WPWebDriver # Codeception supplied classes, which provide assertions and filesystem functions @@ -47,6 +50,8 @@ modules: headers: X_TEST_REQUEST: 1 X_WPBROWSER_REQUEST: 1 + WPFilesystem: + wpRootFolder: '%WP_ROOT_FOLDER%' WPWebDriver: url: '%TEST_SITE_WP_URL%' adminUsername: '%TEST_SITE_ADMIN_USERNAME%' @@ -62,4 +67,6 @@ modules: "--headless=new", "--disable-gpu", "--user-agent=HeadlessChrome" - ] \ No newline at end of file + ] + prefs: + download.default_directory: '%WP_ROOT_FOLDER%' \ No newline at end of file