diff --git a/README.md b/README.md
index fd132e7..7684480 100644
--- a/README.md
+++ b/README.md
@@ -326,6 +326,7 @@ $client->resource( ResourceType::TICKET );
| TAG|✔|–|✔|–|–|✔|✔|–|
| LINK|✔|–|–|–|–|✔|✔|–|
+
## Publishing
1. Add release to [CHANGELOG.md](CHANGELOG.md)
@@ -335,3 +336,24 @@ $client->resource( ResourceType::TICKET );
## Contributing
Bug reports and pull requests are welcome on [GitHub](https://github.com/zammad/zammad-api-client-php). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
+
+### Running tests
+
+Tests require a running Zammad instance with API access enabled. Set the following environment variables:
+
+| Variable | Required | Default | Description |
+|---|---|---|---|
+| `ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL` | Yes | — | URL to Zammad (e.g. `http://localhost:3000/`) |
+| `ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_USERNAME` | Yes | — | Username for authentication |
+| `ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD` | Yes | — | Password for authentication |
+| `ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_TIMEOUT` | No | `30` | Request timeout in seconds |
+
+**Note:** Only username/password authentication is supported for tests.
+
+```bash
+ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL="http://localhost:3000/" \
+ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_USERNAME="admin@example.com" \
+ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD="test" \
+ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_TIMEOUT=120 \
+vendor/bin/phpunit
+```
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 8ba564e..2cd5e9e 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -21,6 +21,7 @@
+
-->
diff --git a/src/HTTPClient.php b/src/HTTPClient.php
index ea8f602..08531a7 100644
--- a/src/HTTPClient.php
+++ b/src/HTTPClient.php
@@ -134,14 +134,22 @@ public function __construct( array $options = [] )
$verifySsl = $options['verify'];
}
+ // Optional: pass additional Guzzle options (e.g. headers, curl options)
+ $connection_options = [];
+ if (is_array($options['connection_options'] ?? null)) {
+ $connection_options = $options['connection_options'];
+ }
+
// Execute constructor of base class
- parent::__construct([
- 'base_uri' => $this->base_url,
- 'timeout' => $timeout,
- 'connect_timeout' => $timeout,
- 'debug' => $debug,
- 'verify' => $verifySsl,
- ]);
+ parent::__construct(
+ [
+ 'base_uri' => $this->base_url,
+ 'timeout' => $timeout,
+ 'connect_timeout' => $timeout,
+ 'debug' => $debug,
+ 'verify' => $verifySsl,
+ ] + $connection_options
+ );
}
/**
diff --git a/test/ZammadAPIClient/Resource/AbstractBaseTest.php b/test/ZammadAPIClient/Resource/AbstractBaseTest.php
index 7f1d554..791143b 100644
--- a/test/ZammadAPIClient/Resource/AbstractBaseTest.php
+++ b/test/ZammadAPIClient/Resource/AbstractBaseTest.php
@@ -17,10 +17,12 @@ abstract class AbstractBaseTest extends TestCase
public static function setUpBeforeClass(): void
{
+ $client_timeout = getenv('ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_TIMEOUT');
+
$client_config = [
- # Set a high timeout for tests to work with slow CI.
- 'timeout' => 30,
+ 'timeout' => !empty($client_timeout) ? $client_timeout : 30,
'debug' => getenv('ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_DEBUG'),
+ 'connection_options' => ['headers' => ['Connection' => 'close']],
];
$env_keys = [