Repository navigation
Tests - #88
Merged
Merged
Tests#88
Conversation
Neither tests nor sources use Prophecy, the only mock is a native PHPUnit mock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hardcoded 2026 range would go stale, the test now asks for the previous calendar month. assertNotEmpty($response) was always true for an object, the test now checks status code and body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test documentation named a merchant and its ID and the payload used the merchant URL. Replaced by a generic description and example.com. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- remove unused GivenGoPay helper (it was loaded by autoload-dev but no test extended it) - report disabled tests as skipped instead of commenting them out (CardTokenTest) or misnaming them (tEETPaymentRefund) - fix doc comments that referred to other payment IDs than the tests use, remove unused variable and redundant block - cover empty array in addition to null in empty data test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI ran PHPUnit with --no-configuration, so PHPUnit 9 defaults applied and deprecations never failed the PHP version matrix. PHPUnit 9 can convert deprecations to exceptions only in the XML configuration. The configuration was invalid (syntaxCheck attribute, non-existent tests/unit suite, env variables only used by the removed GivenGoPay). It now validates against the schema and enables convertDeprecationsToExceptions, failOnWarning and failOnRisky. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UnicodeEncodingTest does not touch the network, it moves to tests/unit. Test classes get their own namespaces and are autoloaded via PSR-4, so the require_once calls between test files are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RecordingBrowser replaces JsonBrowser, records sent requests and returns queued responses, so GoPay, OAuth2, CachedOAuth and Payments are tested without network: - URL building with and without /api, headers, Accept-Language, custom User-Agent, JSON and FORM body encoding - config defaults, Config object, fromArray/toArray - token request, expiration, failed authorization, cache key - token caching, renewal of expired and failed tokens - HTTP method, path, content type and body of every endpoint, createPayment defaults, OAuth error returned without calling the endpoint - JsonBrowser transport error converted to status 500 - payments() factory and Api::payments() JsonBrowser creates its Guzzle client internally, HTTP error responses stay covered by integration tests only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Integration tests call the GoPay sandbox and create real sandbox payments, running them in all 12 matrix jobs multiplied the load and the chance of flaky failures. The matrix now runs the offline unit suite, integration tests run once on Ubuntu with PHP 8.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hamcrest was used only by the removed GivenGoPay helper, all tests use PHPUnit asserts. Its functions file is no longer autoloaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The integration job installs pcov and runs both suites with coverage of src and factory.php. The Clover report is uploaded as the coverage artifact and the text summary is added to the job summary. Composer scripts test, test:unit, test:integration and test:coverage (HTML report in build/coverage/html) run bin/phpunit with the PHP binary that runs Composer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backup of composer.lock from 2020 (Guzzle 6), not used by Composer or referenced anywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Integration tests printed every API response, which buried the
PHPUnit result. Output now goes through TestUtils::debug(), which
prints only when GOPAY_TEST_DEBUG is set:
GOPAY_TEST_DEBUG=1 composer test:integration
It writes to STDERR, so PHPUnit does not capture it and the new
beStrictAboutOutputDuringTests setting (any stdout output makes the
test risky and fails the run) does not break debug runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests mostly checked that the response body is not empty and has no errors key, so they passed e.g. on an error response without that key or with an unexpected status code. testNextOnDemandEET passed even though the API returned PAYMENT_RECURRENCE_STOPPED. IntegrationTestCase provides the client and assertions: - assertSucceeded(): success, status code, JSON body without errors - assertApiError(): status code, error name and code - assertStatusCode(): numeric string on success, int on error - assertPaymentCreated(): CREATED payment matching the sent amount, currency, order number, payment instruments and language, target defaulted to the goid from the SDK config, sandbox gateway URL Endpoint specific checks: recurrence and preauthorization in the response, card details, payment instruments, refund history items, CSV account statement, EET receipts matching the filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- fix hasSucceed() and statusCode description - remove link to the removed GivenGoPay test helper - mention Guzzle as a required dependency - add Development section - formatting fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Require guzzlehttp/guzzle ^7.16.1 and update guzzlehttp/* in composer.lock, so that composer audit reports no known vulnerabilities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run unit tests on Ubuntu with PHP 8.1-8.5 and on Windows and macOS only with PHP 8.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migrate phpunit.xml.dist: convertDeprecationsToExceptions is replaced by failOnDeprecation/failOnNotice, <coverage> filter moved to <source> and the result cache goes to .phpunit.cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the minimum Guzzle version for compatibility, updating Guzzle is left to SDK users. composer.lock stays on Guzzle 7.16.1, so the CI security audit still passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rattkin
approved these changes
Nov 18, 2026
rattkin
left a comment
Member
There was a problem hiding this comment.
PR odpovídá popisu a CI prochází. Vydání PR nepotřebuje, protože se chování SDK nemění.
…LAUDE.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testy
unit(offline) aintegration(proti sandboxu GoPay). Třídy se načítají přes PSR-4 místorequire_once.GoPay,Config,OAuth2,CachedOAuth,Payments(všechny endpointy),payments()factory a kódování JSON se speciálními znaky. Síť nahrazuje testovacíRecordingBrowser.testNextOnDemandEET) dřív procházel i při chybě API.GOPAY_TEST_DEBUG. Test, který vypisuje na stdout, shodí běh.CI (GitHub Actions)
security-auditspouštícomposer audit --lockednad zamčenými závislostmi.coverage.phpunit.xml.dist, takže deprecations, notices, warnings a risky testy shodí build.actions/checkoutpovýšen z v6 na v7.Závislosti (jen vývojové a
composer.lock)phpunit.xml.distpřevedený na nový formát. Verze 11 by vyžadovala PHP 8.2.composer.lockaktualizovaný Guzzle (7.7.0 → 7.16.1) a PSR-7 kvůli 13 bezpečnostním advisories. Minimum vcomposer.jsonse nemění, aktualizace Guzzlu zůstává na uživatelích SDK.phpspec/prophecy,phpspec/prophecy-phpunit,hamcrest/hamcrest-phpa zastaralýcomposer.bak.test,test:unit,test:integration,test:coverage.