Skip to content

Add tests - #33

Closed
d-g-codappix wants to merge 23 commits into
mainfrom
add-tests
Closed

d-g-codappix wants to merge 23 commits into
mainfrom
add-tests

Conversation

@d-g-codappix

Copy link
Copy Markdown
Collaborator

No description provided.

d-g-codappix and others added 18 commits November 9, 2026 09:52
[TASK] Add TYPO3 v14 support
Composer installs the dependencies, the binaries and the TYPO3 instance
into .Build/ now, like all other cart extensions. composer.lock is
disabled, so every install resolves the latest allowed versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests should be executable for local testing and GitHub
Actions with nearly the same context. The composer scripts,
the nix-shell commands and the CI workflow now call the same
scripts in Build/Scripts, which also lift the PHP memory limit.

The extension has no unit, functional or acceptance tests, so
there are no scripts for them yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build/yamllint.yaml existed but was not used. Build/Scripts/lint-yaml.sh
lints all yaml files except the ones ignored by .gitignore. It is
available as composer script project:lint:yaml, as project-lint-yaml in
shell.nix and runs in the GitHub CI.

The truthy rule no longer checks keys, so the "on" key of GitHub
workflows is allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build/Scripts/lint-xml.sh validates the XLIFF files against the XLIFF
1.2 strict schema. Both schemas used for XLIFF are stored in Build/, so
the validation does not need to download xml.xsd from w3.org.
It is available as composer script project:lint:xml, as
project-lint-xml in shell.nix and runs in the GitHub CI.

The XLIFF file uses version 1.2 with its namespace now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build/Scripts/lint-typoscript.sh lints the TypoScript and TSconfig files
in Configuration with Build/typoscriptlint.yaml and fails on warnings.
It is available as composer script project:lint:typoscript, as
project-lint-typoscript in shell.nix and runs in the GitHub CI.

The content of conditions is indented now, RepeatingRValue is disabled
because extracting repeated values into constants would add them to the
public configuration of the extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GPL-2.0+ is a deprecated SPDX license identifier, composer validate
recommends GPL-2.0-or-later instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The table of supported versions was part of the README of every branch.
The support status changes over time, but the README of older branches
is not updated, so it showed an outdated status. The table is maintained
in the documentation of the main branch now, and the READMEs of all
branches link to it.

SECURITY.md on the main branch describes which versions get security
updates and that vulnerabilities are reported to the TYPO3 Security
Team. GitHub shows the file in the security tab of the repository.

The README is aligned with the other cart extensions:
- It links to the extension documentation, also for the installation.
- The release management section is removed, it was copied from
  another extension and named it instead of this one.
- The changelog link points to the current documentation URL.
- The headings use consistent levels and numbering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ProviderRedirect listener splits the provider of every payment into
provider and clearing type. Providers of other extensions without an
underscore, e.g. PAYPAL of cart_paypal, caused the warning
"Undefined array key 1". The missing clearing type defaults to an
empty string now, like in the PaymentController.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Girosolution calls the notifyAction after a payment and only expects the
HTTP status. The action rendered a template that does not exist, so the
request failed after the payment had been updated, and Girosolution
retried the notification. The action returns an empty response now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since TYPO3 v14 the PaymentMethodsLoaderInterface returns the payment
methods as services indexed by their id instead of the TypoScript
configuration. The ClearCart listener still looked for
options.<id>.preventClearCart in the result, so the cart was always
cleared. The option is read from the configuration of the service now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extension had no tests so far. The setup follows the other cart
extensions: Build/phpunit.xml.dist with the testsuites unit and
functional, run via Build/Scripts/phpunit.sh, the composer scripts
project:test:unit and project:test:functional, the commands
project-test-unit and project-test-functional in shell.nix and a CI job
for all supported PHP versions. The tests are linted and analysed by
PHPStan as well, Build/phpunit.xml.dist is validated by the xml lint.

The unit tests cover the credential loaders, the events and the event
listeners as far as they do not need the API of Girosolution.

The functional tests send the notification of Girosolution to the
frontend and check the stored payment and transaction and the
dispatched events for successful and canceled payments, for repeated
notifications, for a wrong hash and an unknown cart. They also verify
that credentials from TYPO3_CONF_VARS override the ones from TypoScript.
The events are recorded by the listener of the test extension
girosolution_test, as frontend requests use their own listener provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build/Scripts/coverage.sh runs every testsuite in its own phpunit
process like phpunit.sh, merges the coverage with phpcov, prints the
summary and writes the html report to .Build/coverage. It is available
as composer script project:test:coverage and as project-test-coverage in
shell.nix, which provides php with xdebug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Girosolution redirects the customer to the redirectAction after the
payment. The tests check the redirect to the order or back to the cart,
the stored payment and transaction, the dispatched events, the cart and
flash message restored in the session after a canceled payment and the
rejection of requests with a wrong hash or without cart hash.

The tests of the notifyAction are moved to their own class and cover
PayPal payments, unknown clearing types and payments without
transaction as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test extension girosolution_test registers its listener in
Services.php instead of Services.yaml. The classes are referenced by
their class constants, so a renamed or moved class is found by the IDE
and PHPStan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d-g-codappix and others added 3 commits November 14, 2026 15:49
The PaymentController, ext_localconf.php and the TCA override were the
only PHP files without strict types. The tests cover the controller, so
type errors in calls from it are detected now.

ext_emconf.php is left untouched, it only returns the configuration
for the TYPO3 Extension Repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rule declare_strict_types reports PHP files without strict types,
project:cgl:fix adds the declaration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The services were configured partly in Services.yaml and partly in
Services.php. All services are configured in Services.php now, the
classes are referenced by their class constants, so a renamed or moved
class is found by the IDE and PHPStan.

A functional test checks the registered event listeners and that the
cart is cleared before the customer is redirected to Girosolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The email listener of cart is registered a second time for the
FinishEvent of this extension, because the FinishEvent of cart is not
dispatched for payments with Girosolution. The service id looked like a
class of this extension that does not exist. It is a descriptive id
now, the class of the service is the listener of cart.

The identifier of the event listener is unchanged.

The change is documented as breaking change in the changelog of 6.0,
the release which introduces it. The changelog of 7.0 is added as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The version 6.x requires extcode/cart 11.x, not 10.x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant