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

Run tests against WordPress 6.7 RC4 #83

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.dist.testing
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ CONVERTKIT_API_CUSTOM_FIELD_ID="258240"
CONVERTKIT_API_FORM_ID="2765139"
CONVERTKIT_API_LEGACY_FORM_ID="470099"
CONVERTKIT_API_LANDING_PAGE_ID="2765196"
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/99f1db6843"
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.kit.com/99f1db6843"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID="2849151"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL="https://cheerful-architect-3237.ck.page/cc5eb21744"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL="https://cheerful-architect-3237.kit.com/cc5eb21744"
CONVERTKIT_API_LEGACY_LANDING_PAGE_ID="470103"
CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.kit.com/landing_pages/470103"
CONVERTKIT_API_POST_ID="3175837"
Expand All @@ -37,4 +37,4 @@ CONVERTKIT_API_TAG_NAME_2="gravityforms-tag-1"
CONVERTKIT_API_TAG_ID_2="2907192"
CONVERTKIT_API_SUBSCRIBER_EMAIL="optin@n7studios.com"
CONVERTKIT_API_SUBSCRIBER_ID="1579118532"
CONVERTKIT_API_RECOMMENDATIONS_JS="https://cheerful-architect-3237.ck.page/WnaDZ370gtgOq750dwOl-recommendations.js"
CONVERTKIT_API_RECOMMENDATIONS_JS="https://cheerful-architect-3237.kit.com/WnaDZ370gtgOq750dwOl-recommendations.js"
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ CONVERTKIT_API_CUSTOM_FIELD_ID="258240"
CONVERTKIT_API_FORM_ID="2765139"
CONVERTKIT_API_LEGACY_FORM_ID="470099"
CONVERTKIT_API_LANDING_PAGE_ID="2765196"
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/99f1db6843"
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.kit.com/99f1db6843"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID="2849151"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL="https://cheerful-architect-3237.ck.page/cc5eb21744"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL="https://cheerful-architect-3237.kit.com/cc5eb21744"
CONVERTKIT_API_LEGACY_LANDING_PAGE_ID="470103"
CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.kit.com/landing_pages/470103"
CONVERTKIT_API_POST_ID="3175837"
Expand All @@ -45,4 +45,4 @@ CONVERTKIT_API_SUBSCRIBER_EMAIL="optin@n7studios.com"
CONVERTKIT_API_SUBSCRIBER_ID="1579118532"
CONVERTKIT_API_SIGNED_SUBSCRIBER_ID=
CONVERTKIT_API_SUBSCRIBER_TOKEN=
CONVERTKIT_API_RECOMMENDATIONS_JS="https://cheerful-architect-3237.ck.page/WnaDZ370gtgOq750dwOl-recommendations.js"
CONVERTKIT_API_RECOMMENDATIONS_JS="https://cheerful-architect-3237.kit.com/WnaDZ370gtgOq750dwOl-recommendations.js"
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
wp-versions: [ 'latest' ] #[ 'latest', '6.1.1' ]
wp-versions: [ '6.7-RC4' ] #[ 'latest', '6.1.1' ]
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] #[ '7.4', '8.0', '8.1', '8.2' ]

# Steps to install, configure and run tests
Expand Down
4 changes: 2 additions & 2 deletions tests/_data/dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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', '57155', 'yes'),
(46, 'db_version', '58975', 'yes'),
(47, 'uploads_use_yearmonth_folders', '1', 'yes'),
(48, 'upload_path', '', 'yes'),
(49, 'blog_public', '1', 'yes'),
Expand Down Expand Up @@ -177,7 +177,7 @@ 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', '57155', 'yes'),
(99, 'initial_db_version', '58975', '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'),
Expand Down
12 changes: 6 additions & 6 deletions tests/wpunit/APITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ public function testGetGrowthStatsWithStartDate()
$this->assertArrayHasKey('ending', $result['stats']);

// Assert start and end dates were honored.
$this->assertEquals($result['stats']['starting'], $starting->format('Y-m-d') . 'T00:00:00-04:00');
$this->assertEquals($result['stats']['ending'], $ending->format('Y-m-d') . 'T23:59:59-04:00');
$this->assertEquals($result['stats']['starting'], $starting->format('Y-m-d') . 'T00:00:00-05:00');
$this->assertEquals($result['stats']['ending'], $ending->format('Y-m-d') . 'T23:59:59-05:00');
}

/**
Expand Down Expand Up @@ -761,8 +761,8 @@ public function testGetGrowthStatsWithEndDate()
$this->assertArrayHasKey('ending', $result['stats']);

// Assert start and end dates were honored.
$this->assertEquals($result['stats']['starting'], $starting->format('Y-m-d') . 'T00:00:00-04:00');
$this->assertEquals($result['stats']['ending'], $ending->format('Y-m-d') . 'T23:59:59-04:00');
$this->assertEquals($result['stats']['starting'], $starting->format('Y-m-d') . 'T00:00:00-05:00');
$this->assertEquals($result['stats']['ending'], $ending->format('Y-m-d') . 'T23:59:59-05:00');
n7studios marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -6173,7 +6173,7 @@ public function testGetLandingPageHTML()
{
$result = $this->api->get_landing_page_html($_ENV['CONVERTKIT_API_LANDING_PAGE_URL']);
$this->assertNotInstanceOf(WP_Error::class, $result);
$this->assertStringContainsString('<form method="POST" action="https://app.convertkit.com/forms/' . $_ENV['CONVERTKIT_API_LANDING_PAGE_ID'] . '/subscriptions" data-sv-form="' . $_ENV['CONVERTKIT_API_LANDING_PAGE_ID'] . '" data-uid="99f1db6843" class="formkit-form"', $result);
$this->assertStringContainsString('<form method="POST" action="https://app.kit.com/forms/' . $_ENV['CONVERTKIT_API_LANDING_PAGE_ID'] . '/subscriptions" data-sv-form="' . $_ENV['CONVERTKIT_API_LANDING_PAGE_ID'] . '" data-uid="99f1db6843" class="formkit-form"', $result);

// Check that rocket-loader.min.js has been removed, as including it breaks landing page redirects.
$this->assertStringNotContainsString('rocket-loader.min.js', $result);
Expand All @@ -6198,7 +6198,7 @@ public function testGetLandingPageWithCharacterEncodingHTML()
{
$result = $this->api->get_landing_page_html($_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL']);
$this->assertNotInstanceOf(WP_Error::class, $result);
$this->assertStringContainsString('<form method="POST" action="https://app.convertkit.com/forms/' . $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID'] . '/subscriptions" data-sv-form="' . $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID'] . '" data-uid="cc5eb21744" class="formkit-form"', $result);
$this->assertStringContainsString('<form method="POST" action="https://app.kit.com/forms/' . $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID'] . '/subscriptions" data-sv-form="' . $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID'] . '" data-uid="cc5eb21744" class="formkit-form"', $result);

// Assert that character encoding works, and that special characters are not malformed.
$this->assertStringContainsString('Vantar þinn ungling sjálfstraust í stærðfræði?', $result);
Expand Down
2 changes: 1 addition & 1 deletion tests/wpunit/ResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public function testRefreshLandingPages()
// did call both `get_landing_pages` and `get_legacy_landing_pages` methods.
$this->assertArrayHasKey($_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_ID'], $resources);
$this->assertArrayHasKey('url', $resources[ $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_ID'] ]);
$this->assertEquals('https://app.convertkit.com/landing_pages/' . $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_ID'], $resources[ $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_ID'] ]['url']);
$this->assertEquals('https://app.kit.com/landing_pages/' . $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_ID'], $resources[ $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_ID'] ]['url']);

// Delete resources.
$this->resource->delete();
Expand Down
Loading