[ECP-9698] Fix REST api tests and add new tests for donation campaigns#2973
[ECP-9698] Fix REST api tests and add new tests for donation campaigns#2973candemiralp merged 7 commits intodevelop-10from
Conversation
There was a problem hiding this comment.
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/Makefilehas been updated to include a newsetup-restapitarget that prepares thephpunit_rest.xmlfile by replacing a placeholder URL with the actualMAGENTO_HOSTenvironment variable. Therestapitarget 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 likeTESTS_BASE_URL,TESTS_WEBSERVICE_USER, etc., has been removed as its contents have been migrated to the newphpunit.xml.distfile.
Changelog
- .github/Makefile
- Added
REST_XML_DISTandREST_XMLvariables to define paths for test configuration files. - Added
setup-restapitarget to create a dynamicphpunit_rest.xmlby substituting the base URL placeholder. - Updated
restapitarget to use the generatedphpunit_rest.xmlfile and removed the hardcoded--prependargument.
- Added
- Removed custom test configuration file
- Deleted the custom PHP file (
.github/phpunit_rest.php) that defined test configuration constants.
- Deleted the custom PHP file (
- 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
-
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. ↩
There was a problem hiding this comment.
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
sedcommand insetup-restapiappends to theREST_XMLfile, which could lead to the file growing indefinitely. Consider overwriting the file instead. - DonationsTest XDEBUG parameter: The
XDEBUG_SESSION_START=PHPSTORMparameter is hardcoded in theresourcePathand should be removed or conditionally included only in a development environment. - DonationsTest returnUrl: The
returnUrlin the donation payload is hardcoded and should be configurable or dynamically generated based on the environment. - DonationsTest stateData: The
stateDatain thepaymentMethodis 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.
|


Description
This PR fixes the REST api functional tests workflow and adds refactors the test case to support
/donationCampaignsendpoint.Tested scenarios