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

Tests: Add PHP 8.4 and move PCOV to PHP 8.2 #2878

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
9e074ae
Add new Rest API base classes
vaurdan Aug 22, 2024
6ad9d44
Implement the Content Helper API namespace
vaurdan Aug 22, 2024
7330236
Add tests for the new REST API classes
vaurdan Aug 22, 2024
e500032
Update UI providers to use the new API endpoints
vaurdan Aug 22, 2024
04de750
Remove unused code and initializations
vaurdan Aug 22, 2024
044b48d
Merge branch 'develop' into refactor/internal-api-content-helper
vaurdan Aug 22, 2024
1b45964
Fix sonarcloud issues
vaurdan Aug 22, 2024
f6f09ac
Merge branch 'develop' into refactor/internal-api-content-helper
vaurdan Aug 22, 2024
fe19315
Refactor to avoid consts and use getters instead
vaurdan Aug 23, 2024
90c9808
Fix minor docblock issues per code review
vaurdan Aug 23, 2024
b000751
Merge branch 'develop' into refactor/internal-api-content-helper
acicovic Aug 26, 2024
77dbd2b
Apply code review suggestions by @acicovic
vaurdan Aug 26, 2024
78395a7
Rename API parameter `content` to `text`
vaurdan Aug 26, 2024
a2cefb5
Add `stats` endpoint
vaurdan Aug 29, 2024
f1bb531
Update the UI to use the new API endpoints
vaurdan Aug 29, 2024
fb3941a
Delete the old endpoints
vaurdan Aug 29, 2024
5d785dd
Add tests
vaurdan Aug 29, 2024
508b199
Apply code review suggestions by @acicovic
vaurdan Aug 29, 2024
5e606da
Add `stats` endpoint
vaurdan Aug 29, 2024
89ef1bb
Update the UI to use the new API endpoints
vaurdan Aug 29, 2024
e14f28c
Delete the old endpoints
vaurdan Aug 29, 2024
5978a36
Add tests
vaurdan Aug 29, 2024
ce9be3a
Merge remote-tracking branch 'origin/refactor/internal-api-stats' int…
vaurdan Aug 29, 2024
fa5ee00
Fix E2E test
vaurdan Aug 29, 2024
e252949
Add `settings` endpoints
vaurdan Aug 30, 2024
36ade72
Update UI to use the new settings API
vaurdan Aug 30, 2024
5b62a4e
Add tests
vaurdan Aug 30, 2024
de7630a
Remove old code
vaurdan Aug 30, 2024
f06c489
Improve comments and whitespace
acicovic Sep 5, 2024
313851e
Merge pull request #2731 from Parsely/refactor/internal-api-content-h…
acicovic Sep 5, 2024
64ac937
Merge pull request #2734 from Parsely/refactor/internal-api-stats
acicovic Sep 5, 2024
32a412a
class-base-endpoint.php: Fix incorrect whitespace
acicovic Sep 5, 2024
83367fa
Merge pull request #2737 from Parsely/update/fix-incorrect-whitespace…
acicovic Sep 5, 2024
3f80988
Endpoints/class-base-endpoint.php: Fix incorrect whitespace
acicovic Sep 5, 2024
8380fc2
Merge pull request #2738 from Parsely/update/fix-incorrect-whitespace…
acicovic Sep 5, 2024
d68ad09
Improve comments and whitespace
acicovic Sep 6, 2024
b2eb9bb
Merge pull request #2735 from Parsely/refactor/internal-api-settings
acicovic Sep 6, 2024
e6e7d10
Merge branch 'develop' into refactor/internal-api
acicovic Sep 6, 2024
1b24e40
Improve comments and whitespace
acicovic Sep 6, 2024
260f014
Merge branch 'develop' into refactor/internal-api
acicovic Sep 9, 2024
f31ff32
Merge branch 'develop' into refactor/internal-api
acicovic Sep 11, 2024
6f6bd16
Merge branch 'develop' into refactor/internal-api
acicovic Sep 12, 2024
a9f47bd
Merge branch 'develop' into refactor/internal-api
acicovic Sep 12, 2024
203f6cb
Merge branch 'develop' into refactor/internal-api
acicovic Sep 16, 2024
3e1efb7
REST API Refactor: Apply fixes/suggestions from the other PRs (#2812)
vaurdan Oct 2, 2024
81d773d
Implement the new Content API service, and remove old RemoteAPI code
vaurdan Oct 10, 2024
1a7ee36
Implement caching mechanism for service endpoints
vaurdan Oct 10, 2024
5352a97
Implement the Suggestions API service
vaurdan Oct 11, 2024
2338a2c
Address PHPCS & PHPStan errors and warnings
vaurdan Oct 17, 2024
ee380f4
Merge branch 'refactor/internal-api' into refactor/external-services
vaurdan Oct 18, 2024
1c280da
Fix post-merge issues and namespaces
vaurdan Oct 18, 2024
e103011
Add condition when validate api credentials returns false.
vaurdan Oct 18, 2024
ccaa940
Address code review feedback
vaurdan Oct 18, 2024
be67fa9
Tests: Add PHP 8.4 and move PCOV to PHP 8.2
acicovic Oct 18, 2024
096bf59
Attempt to fix PHP 8.4 deprecation errors
acicovic Oct 18, 2024
a391720
Adjust some DocBlocks and whitespace
acicovic Oct 21, 2024
97f6d25
Make the services base URL static, and remove the old consts
vaurdan Oct 21, 2024
eb61fda
Fix PHPStan (not including tests)
vaurdan Oct 21, 2024
11a0ae2
Fix misplaced `@since` tag
vaurdan Oct 21, 2024
77efe11
Merge branch 'refactor/external-services' into update/add-php-8.4-to-…
acicovic Oct 21, 2024
0a653e8
PCH Refactor: Refactor the external services (#2873)
vaurdan Oct 21, 2024
53a6602
Merge branch 'refactor/internal-api' into update/add-php-8.4-to-tests…
acicovic Oct 21, 2024
95a2394
PCH Refactor: Update integration tests (#2885)
vaurdan Oct 25, 2024
de75585
Merge branch 'develop' into refactor/internal-api
vaurdan Oct 25, 2024
f66f6cf
Rebuild assets
vaurdan Oct 25, 2024
b88e9ba
Merge branch 'refactor/internal-api' into update/add-php-8.4-to-tests…
acicovic Oct 25, 2024
3a73b33
Merge branch 'develop' into update/add-php-8.4-to-tests-and-move-pcov…
acicovic Oct 25, 2024
62115c5
Fix PHP 8.4 deprecation errors
acicovic Oct 25, 2024
081311d
Merge branch 'develop' into update/add-php-8.4-to-tests-and-move-pcov…
vaurdan Oct 30, 2024
13e9987
Add missing const to the experimental phpunit config.
vaurdan Oct 30, 2024
f7d2f06
Merge remote-tracking branch 'origin/update/add-php-8.4-to-tests-and-…
vaurdan Oct 30, 2024
88ccbee
Merge branch 'develop' into update/add-php-8.4-to-tests-and-move-pcov…
acicovic Oct 31, 2024
d6ee573
Merge branch 'develop' into update/add-php-8.4-to-tests-and-move-pcov…
acicovic Nov 1, 2024
d7e6372
integration-tests.yml: Improve testing logic
acicovic Nov 1, 2024
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
39 changes: 15 additions & 24 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,25 @@ jobs:
WP_VERSION: ${{ matrix.wp }}

strategy:
# PHP 7.2 uses PHPUnit 8.5.21
# PHP 7.3 uses PHPUnit 9.5.10
# PHP 7.4 uses PHPUnit 9.5.10
# PHP 8.0 uses PHPUnit 9.5.10
# PHP 8.1 uses PHPUnit 9.5.10
# PHP 8.2 uses PHPUnit 9.5.10
# Note: Different PHP versions use different PHPUnit versions.
# Keys:
# - coverage: Whether to run the tests with code coverage.
# - experimental: Whether the build is "allowed to fail".
matrix:
php: [ '7.2', '7.3', '7.4', '8.0']
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.3']
wp: ['latest']
coverage: [none]
experimental: [false]
include:
- php: '8.1'
coverage: pcov
- php: '8.2'
coverage: pcov # Warning: PCOV might not work for PHP 8.4 or newer according to https://thephp.cc/articles/pcov-or-xdebug.
extensions: pcov
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
experimental: false
- php: '8.2'
wp: 'trunk'
coverage: none
experimental: false
- php: '8.3'
- php: '8.4'
wp: 'trunk'
coverage: none
experimental: false
experimental: true
fail-fast: false
continue-on-error: ${{ matrix.experimental }}
steps:
Expand Down Expand Up @@ -91,18 +82,18 @@ jobs:
- name: Prepare environment for integration tests
run: composer prepare-ci --no-interaction

- name: Run integration tests (single site)
if: ${{ matrix.php != 8.0 && ! matrix.experimental }}
- name: Run integration tests
if: ${{ !matrix.experimental && matrix.coverage == 'none' }}
run: composer testwp --no-interaction

- name: Run integration tests experimental
- name: Run integration tests (multisite)
if: ${{ !matrix.experimental && matrix.coverage == 'none' }}
run: composer testwp-ms --no-interaction

- name: Run integration tests (experimental)
if: ${{ matrix.experimental }}
run: composer testwp-experimental --no-interaction

- name: Run integration tests (multi site)
if: ${{ matrix.php != 8.0 && ! matrix.experimental }}
run: composer testwp-ms --no-interaction

- name: Run integration tests (multisite site with code coverage)
if: ${{ matrix.php == 8.1 }}
- name: Run integration tests (multisite with code coverage)
if: ${{ matrix.coverage == 'pcov' }}
run: composer coveragewp-ci --no-interaction
15 changes: 7 additions & 8 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,24 @@ jobs:
WP_VERSION: latest

strategy:
# PHP 7.2 uses PHPUnit 8.5.21
# PHP 7.3 uses PHPUnit 9.5.10
# PHP 7.4 uses PHPUnit 9.5.10
# PHP 8.0 uses PHPUnit 9.5.10
# PHP 8.1 uses PHPUnit 9.5.10
# Note: Different PHP versions use different PHPUnit versions.
# Keys:
# - coverage: Whether to run the tests with code coverage.
# - experimental: Whether the build is "allowed to fail".
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.2', '8.3']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.3']
coverage: [none]
experimental: [false]
include:
# Run code coverage for only one PHP version
- php: '8.1'
coverage: pcov
- php: '8.2'
coverage: pcov # Warning: PCOV might not work for PHP 8.4 or newer according to https://thephp.cc/articles/pcov-or-xdebug.
extensions: pcov
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
experimental: false
- php: '8.4'
coverage: none
experimental: true
fail-fast: false
continue-on-error: ${{ matrix.experimental }}
steps:
Expand Down
1 change: 1 addition & 0 deletions phpunit-experimental.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<server name="SERVER_PORT" value="80"/>
<server name="HTTP_HOST" value="localhost"/>
<server name="REMOTE_ADDR" value="127.0.0.1"/>
<const name="INTEGRATION_TESTS_RUNNING" value="true"/>
</php>
<testsuites>
<testsuite name="integration">
Expand Down
2 changes: 1 addition & 1 deletion src/class-parsely.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public function set_default_content_helper_settings_values(): void {
* for context (Default null for current).
* @return string
*/
public static function get_settings_url( int $_blog_id = null ): string {
public static function get_settings_url( ?int $_blog_id = null ): string {
return get_admin_url( $_blog_id, 'options-general.php?page=' . self::MENU_SLUG );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function is_pch_feature_enabled_for_user(): bool {
* @param WP_REST_Request|null $request The request object.
* @return bool|WP_Error True if the endpoint is available.
*/
public function is_available_to_current_user( WP_REST_Request $request = null ) {
public function is_available_to_current_user( ?WP_REST_Request $request = null ) {
$can_use_feature = $this->is_pch_feature_enabled_for_user();

if ( ! $can_use_feature ) {
Expand Down
8 changes: 4 additions & 4 deletions src/services/content-api/class-content-api-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ protected function register_endpoints(): void {
*/
public function get_post_details(
string $url,
string $period_start = null,
string $period_end = null
?string $period_start = null,
?string $period_end = null
) {
/** @var Endpoints\Endpoint_Analytics_Post_Details $endpoint */
$endpoint = $this->get_endpoint( '/analytics/post/detail' );
Expand Down Expand Up @@ -116,8 +116,8 @@ public function get_post_details(
*/
public function get_post_referrers(
string $url,
string $period_start = null,
string $period_end = null
?string $period_start = null,
?string $period_end = null
) {
/** @var Endpoints\Endpoint_Referrers_Post_Detail $endpoint */
$endpoint = $this->get_endpoint( '/referrers/post/detail' );
Expand Down
Loading