ArangoClientTestTrait
Shared options + client-construction helpers for the `arango:test:clients` live integration command.
Plays the same role as
ApiClientTrait does for
the auth:test:* HTTP commands, but the target is the ArangoDB HTTP
API directly (no Bearer / OIDC) and the resolved client is an
ArangoClient rather than a raw Guzzle client.
The trait reads the project's [arango] configuration through
ClientOptions::fromArray() and lets the operator override any
connection field through CLI options:
--endpoint <url>— override the server endpoint (default: TOML).--user <name>— override the user (default: TOML).--password <pw>— override the password (default: TOML).--database <db>— override the default database (the test command always works on its own ephemeral database; this option only changes the fallback the ArangoClient resolves to).--no-cleanup— keep the test database around after the run.--step <range>— limit the suite to a subset of steps.
Tags
Table of Contents
Constants
- ARANGO_CONFIG : string = 'arangoConfig'
- DI key carrying the `[arango]` configuration array.
- OPTION_DATABASE : string = 'database'
- OPTION_ENDPOINT : string = 'endpoint'
- OPTION_NO_CLEANUP : string = 'no-cleanup'
- OPTION_PASSWORD : string = 'password'
- OPTION_USER : string = 'user'
Properties
- $arangoConfig : array<string, mixed>
- Resolved configuration array, captured at construction time.
Methods
- buildArangoClient() : ArangoClient|null
- Builds an {@see ArangoClient} from the trait's stored config, applying any CLI override from `$input`. Reports the resolved endpoint / user / database to `$io` for transparency. Returns null when the config is missing or incomplete.
- check() : array{0: int, 1: int}
- Reports a single assertion to `$io` and returns the updated `[ passed , errors ]` counters.
- configureArangoTestOptions() : void
- Adds the trait's CLI options to the consuming command.
- initializeArangoTestClient() : void
- Captures the `[arango]` configuration injected through the command's `init` array. Called from the consuming command's constructor.
- shouldCleanup() : bool
- Returns true when `--no-cleanup` is NOT set.
- stringOption() : string|null
- Reads a string CLI option, returning null when missing or empty.
Constants
ARANGO_CONFIG
DI key carrying the `[arango]` configuration array.
public
string
ARANGO_CONFIG
= 'arangoConfig'
Forwarded through the init array at construction time. The
trait reads it via initializeArangoTestClient() and keeps
the resolved options for later builds.
OPTION_DATABASE
public
string
OPTION_DATABASE
= 'database'
OPTION_ENDPOINT
public
string
OPTION_ENDPOINT
= 'endpoint'
OPTION_NO_CLEANUP
public
string
OPTION_NO_CLEANUP
= 'no-cleanup'
OPTION_PASSWORD
public
string
OPTION_PASSWORD
= 'password'
OPTION_USER
public
string
OPTION_USER
= 'user'
Properties
$arangoConfig
Resolved configuration array, captured at construction time.
protected
array<string, mixed>
$arangoConfig
= []
Methods
buildArangoClient()
Builds an {@see ArangoClient} from the trait's stored config, applying any CLI override from `$input`. Reports the resolved endpoint / user / database to `$io` for transparency. Returns null when the config is missing or incomplete.
protected
buildArangoClient(InputInterface $input, SymfonyStyle $io) : ArangoClient|null
Parameters
- $input : InputInterface
- $io : SymfonyStyle
Return values
ArangoClient|nullcheck()
Reports a single assertion to `$io` and returns the updated `[ passed , errors ]` counters.
protected
check(SymfonyStyle $io, mixed $condition, string $label, int $passed, int $errors) : array{0: int, 1: int}
Same contract as the auth:test:* ApiAssertionsTrait::check(),
inlined here so the new arango command does not depend on the
auth namespace.
Parameters
- $io : SymfonyStyle
- $condition : mixed
- $label : string
- $passed : int
- $errors : int
Return values
array{0: int, 1: int}configureArangoTestOptions()
Adds the trait's CLI options to the consuming command.
protected
configureArangoTestOptions() : void
initializeArangoTestClient()
Captures the `[arango]` configuration injected through the command's `init` array. Called from the consuming command's constructor.
protected
initializeArangoTestClient(array<string, mixed> $init) : void
Parameters
- $init : array<string, mixed>
shouldCleanup()
Returns true when `--no-cleanup` is NOT set.
protected
shouldCleanup(InputInterface $input) : bool
Parameters
- $input : InputInterface
Return values
boolstringOption()
Reads a string CLI option, returning null when missing or empty.
private
stringOption(InputInterface $input, string $name) : string|null
Parameters
- $input : InputInterface
- $name : string