Download the PHP package mock-server/mockserver-testcontainers without Composer
On this page you can find all versions of the php package mock-server/mockserver-testcontainers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mock-server/mockserver-testcontainers
More information about mock-server/mockserver-testcontainers
Files in mock-server/mockserver-testcontainers
Package mockserver-testcontainers
Short Description Testcontainers module for MockServer — starts a mockserver/mockserver Docker container, waits for readiness, and exposes connection helpers plus a ready-wired MockServer client.
License Apache-2.0
Homepage https://www.mock-server.com
Informations about the package mockserver-testcontainers
mockserver-testcontainers (PHP)
A Testcontainers module for MockServer — the open-source HTTP(S) mock server and proxy.
It starts the official mockserver/mockserver Docker image, waits for MockServer to
become ready (PUT /mockserver/status → 200), and exposes connection helpers plus a
ready-wired mock-server/mockserver-client
instance.
Install
Requires PHP >= 8.1 and a running Docker daemon.
Usage
By default the image tag is derived from the installed MockServer PHP client version
(mockserver/mockserver:mockserver-<version>), so the container and client always match.
It falls back to :latest when the version cannot be resolved to a release version. Pass
an explicit image to pin it:
Configuration helpers
Each returns the container for chaining, and must be called before start().
| Method | What it does |
|---|---|
withServerPort(int) |
Change the port MockServer listens on inside the container. |
withLogLevel(string) |
Set MOCKSERVER_LOG_LEVEL (e.g. "DEBUG"). |
withMockServerProperty(string, string) |
Set any MockServer configuration property by its env-var name. |
withInitializationJson(string) |
Copy a JSON file into the container and load its expectations at startup. |
Standard Testcontainers GenericContainer helpers (withNetwork, withEnvironment,
withExposedPorts, …) are also available via inheritance.
Connection helpers (on the started container)
| Method | Returns |
|---|---|
getMockServerClient() |
A cached MockServer\MockServerClient connected to the container. |
getEndpoint() |
http://host:port |
getSecureEndpoint() |
https://host:port (same unified port) |
getServerPort() |
The mapped host port. |
getHost() |
The host MockServer is reachable on. |
License
Apache-2.0
All versions of mockserver-testcontainers with dependencies
testcontainers/testcontainers Version ^1.0
mock-server/mockserver-client Version >=5.15