Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8438183
[UAS-SCOUT] Update CI configuration for PHP 8.3 and 8.4 support
daanrijpkemacb Apr 4, 2026
0f957c0
[UAS-SCOUT] Add PHPCS linting step to CI configuration
daanrijpkemacb Apr 4, 2026
baf1b0a
[UAS-SCOUT] Update PHPUnit action to version 4 and set version to 9.5
daanrijpkemacb Apr 4, 2026
79659d0
[UAS-SCOUT] Run PHPCS & PHPCBF: Standardize code formatting and spaci…
daanrijpkemacb Apr 4, 2026
c68e9df
[UAS-SCOUT] Add linting targets to Makefile for code quality enforcement
daanrijpkemacb Apr 4, 2026
84c20c7
[UAS-SCOUT] Add ownership setup step to CI configuration
daanrijpkemacb Apr 4, 2026
aad5b76
[UAS-SCOUT] Update CI configuration to use Makefile for PHPCS linting
daanrijpkemacb Apr 4, 2026
51d2190
[UAS-SCOUT] Update PHPUnit version and PHP platform configuration
daanrijpkemacb Apr 4, 2026
4195715
[UAS-SCOUT] Update BluemResponse properties to nullable types and adj…
daanrijpkemacb Apr 4, 2026
cfef84c
[UAS-SCOUT] Update BluemResponse properties to nullable types and adj…
daanrijpkemacb Apr 5, 2026
9900833
[UAS-SCOUT] Add Git hooks setup and pre-commit script for PHP file ch…
daanrijpkemacb Apr 5, 2026
fda3d98
[UAS-SCOUT] Update BluemResponse classes to use nullable types for pr…
daanrijpkemacb Apr 5, 2026
563b9fe
[UAS-SCOUT] Refactor BluemConfigurationValidator to use Constants for…
daanrijpkemacb Apr 5, 2026
f40f7ec
[UAS-SCOUT] Add acceptance test suite to PHPUnit configuration and Ma…
daanrijpkemacb Apr 5, 2026
d923955
[UAS-SCOUT] Enhance error handling in BluemMainTest and fix expected …
daanrijpkemacb Apr 5, 2026
d8d342f
[UAS-SCOUT] Refactor BluemRequest and EmandateBluemRequest to utilize…
daanrijpkemacb Apr 5, 2026
d35c334
[UAS-SCOUT] Update PHPUnit configuration to include separate test sui…
daanrijpkemacb Apr 5, 2026
e348112
[UAS-SCOUT] Implement CurlHttpTransport for HTTP requests
daanrijpkemacb Apr 5, 2026
2317402
[UAS-SCOUT] Add AGENTS.md documentation for project overview and deve…
daanrijpkemacb Apr 5, 2026
839bc9d
[UAS-SCOUT] Rename test method for clarity
daanrijpkemacb Apr 5, 2026
5bdebf7
[UAS-SCOUT] Move FakeHttpTransport implementation to a separate file
daanrijpkemacb Apr 5, 2026
671a800
[UAS-SCOUT] Update PHPUnit configuration to adjust test directory paths
daanrijpkemacb Apr 5, 2026
ae6be46
[UAS-SCOUT] Add paymentBrandID to BluemConfiguration and update const…
daanrijpkemacb Apr 5, 2026
3878a65
Add linting step to pre-commit hook
daanrijpkemacb Apr 5, 2026
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
11 changes: 11 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu

if git diff --cached --name-only --diff-filter=ACM | grep -qE '\.php$'; then
echo "PHP files changed — running unit tests..."
make test_unit

make lint
else
echo "No PHP changes — skipping unit tests."
fi
31 changes: 24 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
name: CI

on: [push]

jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
# add 8.4 soon
php-version: ['8.3']

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup .env
run: cp .env.example .env

- name: Setup ownership
run: git config --global --add safe.directory /app

- name: Replace placeholders with GitHub Secrets
run: |
sed -i "s/BLUEM_SENDER_ID=S/BLUEM_SENDER_ID=${{ secrets.BLUEM_SENDER_ID }}/g" .env
sed -i "s/BLUEM_TEST_ACCESS_TOKEN=/BLUEM_TEST_ACCESS_TOKEN=${{ secrets.BLUEM_TEST_ACCESS_TOKEN }}/g" .env

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug

- name: Run composer
uses: php-actions/composer@v5
uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php-version }}

- name: PHPCS Lint
run: make lint

- name: PHPUnit Tests
uses: php-actions/phpunit@v3
uses: php-actions/phpunit@v4
with:
version: 9.5
php_version: 8.1
php_version: ${{ matrix.php-version }}
version: 11
bootstrap: ./vendor/autoload.php
configuration: ./.github/workflows/phpunit.xml
8 changes: 7 additions & 1 deletion .github/workflows/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">../../tests</directory>
<directory suffix="Test.php">../../tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">../../tests/Integration</directory>
</testsuite>
<testsuite name="Acceptance">
<directory suffix="Test.php">../../tests/Acceptance</directory>
</testsuite>
</testsuites>
</phpunit>
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AGENTS.md

## Project at a glance
- `bluem-php` is a PHP 8.3 library for Bluem payment flows: Payments, eMandates, iDIN, and IBAN-name check.
- `src/Bluem.php` is the main orchestration layer: it builds requests, validates XML, sends them through `Transport/`, and turns responses into `Responses/*` objects.
- `src/Webhook.php` handles inbound webhook XML and is intentionally strict: HTTPS POST + `text/xml; charset=UTF-8` + XML/signature validation.

## Code structure to preserve
- `src/Contexts/*` defines service-specific bank/BIC sets and XSD schema paths (`IdentityContext`, `PaymentsContext`, `MandatesContext`).
- `src/Requests/*` owns XML/endpoint generation; `src/Responses/*` wraps `SimpleXMLElement` parsing.
- `src/Transport/` isolates HTTP; `CurlHttpTransport` is the default and is injected into `Bluem` for testability.
- `src/Validators/*` enforces XML and webhook constraints; do not bypass these checks in higher layers.

## Conventions specific to this repo
- Public API names are legacy-compatible and intentionally mixed-case in places (`CreateMandateRequest`, `PerformRequest`, `getConfig`, `Webhook::getPurchaseID()`); avoid renaming unless you are ready to update downstream consumers.
- `phpcs.xml.dist` uses PSR-12 with narrow exceptions for legacy method/property naming and file-header ordering.
- Existing code mixes older style and newer strict typing; prefer small, behavior-preserving edits over broad refactors.

## Developer workflow
- Install deps with `composer install`.
- Lint with `make lint`; auto-fix style with `make lint_fix`.
- Run unit tests with `make test_unit` or `./vendor/bin/phpunit tests/Unit`.
- Run live tests with `make test_integration` / `make test_acceptance`; these require `.env`.
- CI (`.github/workflows/ci.yml`) runs on PHP 8.3, then `make lint`, then PHPUnit.

## Environment and testing
- Copy `.env.example` to `.env` for integration/acceptance tests.
- Required env vars are enforced in `tests/Integration/BluemGenericTestCase.php`: `BLUEM_ENV`, `BLUEM_SENDER_ID`, `BLUEM_BRANDID`, `BLUEM_TEST_ACCESS_TOKEN`, `BLUEM_MERCHANTID`, `BLUEM_MERCHANTRETURNURLBASE`.
- Unit tests typically use a fake transport; integration tests extend the shared base case and hit live Bluem services.

## When changing code
- Update request/response/context pieces together so XML shape, endpoint URL, and validation stay aligned.
- Check `validation/*.xsd` and `examples/` when touching service-specific payloads.
- Keep webhook validation strict; relaxing HTTPS, content-type, or signature checks is a security regression.

24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,26 @@ test_unit:
test_integration:
@printf 'Running integration tests:\n';
@echo "Note: Ensure you have the necessary environment variables set for integration tests in the .env file."
./vendor/bin/phpunit tests/Integration
./vendor/bin/phpunit tests/Integration --testdox --display-errors --display-warnings --display-deprecations --display-phpunit-deprecations --display-notices

test_acceptance:
@printf 'Running acceptance tests:\n';
./vendor/bin/phpunit tests/Acceptance --testdox --display-errors --display-warnings --display-deprecations --display-phpunit-deprecations --display-notices

test:
@printf 'Running all tests:\n';
make test_unit;
make test_acceptance;
make test_integration;

lint:
./vendor/bin/phpcs --standard=phpcs.xml.dist --extensions=php --ignore=vendor/ .

lint_fix:
./vendor/bin/phpcbf --standard=phpcs.xml.dist --extensions=php --ignore=vendor/ .


setup-git-hooks:
@echo "Setting up Git hooks..."
git config core.hooksPath .githooks
chmod +x .githooks/pre-commit
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ No earlier changelog was recorded. Please refer to the [commit log](https://gith
## Testing
For improving future features, unit testing is introduced since november 2021.

The repository also has a PHPCS linting setup: `make lint` runs the shared ruleset from `phpcs.xml.dist`, and CI uses the same lint step so local and automated checks stay aligned. That XML file also contains a few narrow exceptions for legacy naming and file-header issues, which lets the existing public API stay intact without failing the build on historical style violations.

Tests are located in the `tests` folder
To run tests:
```
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
"support": {
"issues": "https://github.com/bluem-development/bluem-php"
},
"config": {
"platform": {
"php": "8.3"
}
},
"require": {
"php": ">=8.3",
"ext-dom": "*",
Expand Down
28 changes: 16 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<ruleset name="Bluem">
<description>Project PHPCS rules with narrow exceptions for the legacy public API.</description>

<config name="ignore_warnings_on_exit" value="1" />

<file>src</file>
<file>tests</file>
<file>examples</file>
<file>rector.php</file>

<exclude-pattern>vendor/*</exclude-pattern>

<rule ref="PSR12">
<exclude name="PSR12.Files.FileHeader.IncorrectOrder" />
</rule>

<rule ref="PSR1.Methods.CamelCapsMethodName">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
</rule>

<rule ref="PSR2.Methods.MethodDeclaration">
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
</rule>

<rule ref="PSR2.Classes.PropertyDeclaration">
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
</rule>
</ruleset>
5 changes: 4 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd">
<phpunit bootstrap="vendor/autoload.php" colors="true" stopOnFailure="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
<testsuite name="Acceptance">
<directory suffix="Test.php">./tests/Acceptance</directory>
</testsuite>
</testsuites>
</phpunit>
Loading
Loading