Repository navigation
Polish code and add github actions for running tests - #19
Merged
Merged
Conversation
* Per-method timeout now defaults to null so setTimeout() applies * Catch all Guzzle bad responses (4xx and 5xx), not only 4xx * Added ConnectionException for network failures * Error messages include method, path and response body * Guzzle client can be injected via the constructor
* Added ClientUnitTest using Guzzle MockHandler * Live tests are skipped when no token or endpoint is set * Split phpunit.xml into unit and api suites * Clean up created data in ProductsTest with finally * Made data providers static, removed brittle assertions
* Updated Guzzle, PHPUnit, php-cs-fixer, phpdotenv, var-dumper * Added phpstan and composer scripts for test, lint and analyse * Added ext-mbstring requirement and keywords * Moved test namespace to autoload-dev * Cache file of php-cs-fixer stays in the project
* Runs composer validate, php-cs-fixer, phpstan and unit tests * PHP 8.3 and 8.4
* Documented ConnectionException * Documented live API tests and the endpoint they use
* New live-api job runs composer test:api with R2O_API_TOKEN secret and R2O_API_ENDPOINT variable * Skipped for fork PRs, runs are serialized to avoid clashes on the test account * Added workflow_dispatch trigger * Tests read env vars via getenv() as well, since $_ENV is empty in CI
r2omvavra
reviewed
Nov 6, 2026
* New php74 job lints src on PHP 7.4 * Installs the library into a throwaway project like a consumer would, since require-dev (PHPUnit 12) cannot resolve on 7.4 * Runs a smoke test that makes a mocked request through Client
* live-api needs checks, so a commit failing lint or phpstan never touches the test account
* Catch TransferException so timeouts, connection resets and redirect loops become ConnectionException, not raw Guzzle exceptions * Static default headers (User-Agent, Accept, Cache-Control) live on the default Guzzle client, so an injected client keeps its own * Added Ready2OrderException as common base class of all library exceptions * Added unit tests for each case, documented in README
* Error messages fall back to status and body when the JSON has no msg, array msg is JSON-encoded * Force http_errors per request so an injected client cannot turn error responses into successes * Normalized slashes when joining endpoint and path * Narrowed Ready2OrderException docs, added Upgrading and Development notes to README * Added unit tests for verbs, URL join, default headers, error fallbacks and truncation
* Registered AccountTest in the api suite * Live job runs with --fail-on-skipped so a missing secret fails instead of skipping * Added Guzzle 7.16 unit test job and job timeouts * Made ProductsTest cleanup per-resource, language test compares localized messages * Added .gitattributes to keep dev files out of dist archives
* URL join uses preg_replace, as php-cs-fixer rewrote rtrim/ltrim to mb_rtrim/mb_ltrim on PHP 8.4, which do not exist on 7.4
* testFluentInterfaceChaining requests products instead of company, which regular tokens cannot read
* It requests the company endpoint, which regular tokens cannot read
* POST, PUT, PATCH and DELETE use RequestOptions::JSON, matching the documented JSON API * Unit test asserts JSON body and Content-Type, README Upgrading notes the change
r2omvavra
approved these changes
Nov 9, 2026
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.
No description provided.