Skip to content

[ECP-9698] Fix REST api tests and add new tests for donation campaigns#2973

Merged
candemiralp merged 7 commits intodevelop-10from
ECP-9698
May 28, 2025
Merged

[ECP-9698] Fix REST api tests and add new tests for donation campaigns#2973
candemiralp merged 7 commits intodevelop-10from
ECP-9698

Conversation

@candemiralp
Copy link
Contributor

@candemiralp candemiralp commented May 27, 2025

Description

This PR fixes the REST api functional tests workflow and adds refactors the test case to support /donationCampaigns endpoint.

Tested scenarios

  • Automated test flows

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @candemiralp, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello team,

Gemini here, providing a summary of this pull request to help everyone quickly understand the changes and context.

The primary goal of this PR, as indicated by the title and patch content, is to address issues with the existing REST API test setup and execution, particularly within the CI environment. It also aims to lay the groundwork for adding new tests, specifically for donation campaigns, although the patch itself focuses on the test infrastructure rather than adding new test files.

The core changes involve migrating the configuration for the REST API tests from a custom PHP file to a standard phpunit.xml.dist file. This standardizes the configuration approach. Alongside this, the Makefile used for running tests in CI is updated to correctly utilize this new XML configuration file and dynamically set the base URL for the tests based on the environment.

Highlights

  • Test Configuration Migration: The configuration for the REST API tests has been moved from a custom PHP file (.github/phpunit_rest.php) to a standard PHPUnit XML configuration file (Test/phpunit_rest.xml.dist). This aligns the REST test setup with standard PHPUnit practices.
  • Makefile Updates for CI: The .github/Makefile has been updated to include a new setup-restapi target that prepares the phpunit_rest.xml file by replacing a placeholder URL with the actual MAGENTO_HOST environment variable. The restapi target is modified to use this generated configuration file, ensuring tests run correctly in the CI environment.
  • Removed Custom Configuration File: The old custom PHP file (.github/phpunit_rest.php) that previously held test configuration constants like TESTS_BASE_URL, TESTS_WEBSERVICE_USER, etc., has been removed as its contents have been migrated to the new phpunit.xml.dist file.

Changelog

  • .github/Makefile
    • Added REST_XML_DIST and REST_XML variables to define paths for test configuration files.
    • Added setup-restapi target to create a dynamic phpunit_rest.xml by substituting the base URL placeholder.
    • Updated restapi target to use the generated phpunit_rest.xml file and removed the hardcoded --prepend argument.
  • Removed custom test configuration file
    • Deleted the custom PHP file (.github/phpunit_rest.php) that defined test configuration constants.
  • Test/phpunit_rest.xml.dist
    • Added a new PHPUnit XML configuration file for REST API functional tests.
    • Included test suite definition pointing to the Adyen REST API test directory.
    • Defined PHP constants (TESTS_BASE_URL, TESTS_WEBSERVICE_USER, etc.) within the <php> section, migrating them from the removed PHP file.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Tests run in the pipeline,
Config files now align.
From PHP to XML,
A better test spell,
Making sure the code is fine.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request aims to fix REST API tests and add new tests for donation campaigns. The changes include modifications to the Makefile, removal of a PHP file, and the addition of a new XML configuration file for PHPUnit. Overall, the changes seem reasonable, but there are a few areas that could be improved.

Summary of Findings

  • Makefile setup-restapi: The sed command in setup-restapi appends to the REST_XML file, which could lead to the file growing indefinitely. Consider overwriting the file instead.
  • DonationsTest XDEBUG parameter: The XDEBUG_SESSION_START=PHPSTORM parameter is hardcoded in the resourcePath and should be removed or conditionally included only in a development environment.
  • DonationsTest returnUrl: The returnUrl in the donation payload is hardcoded and should be configurable or dynamically generated based on the environment.
  • DonationsTest stateData: The stateData in the paymentMethod is hardcoded and should be generated or retrieved dynamically for better test reliability.

Merge Readiness

The pull request introduces important fixes and new tests. However, the hardcoded debugging parameter and URLs should be addressed before merging. I am unable to approve this pull request, and recommend that others review and approve this code before merging. At a minimum, the high severity issues should be addressed before merging.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@candemiralp candemiralp merged commit 11b2fa5 into develop-10 May 28, 2025
11 of 14 checks passed
@candemiralp candemiralp deleted the ECP-9698 branch May 28, 2025 11:58
@khushboo-singhvi khushboo-singhvi added the Fix Indicates a bug fix label Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Indicates a bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants