ArangoFacadeTestCommand extends Kernel uses ArangoClientTestTrait
Live end-to-end integration test for the high-level {@see ArangoDB} façade (and its embedded {@see \oihana\arango\db\traits\CollectionManagementTrait}).
Complementary to arango:test:clients:
arango:test:clientsexercises the low-level new client (oihana/arango/clients/: ArangoClient, Database, Collection, Cursor, …) directly.arango:test:facadeexercises the high-level façade (oihana/arango/db/ArangoDB) which delegates internally to the new client. The whole point of this command is to verify that the 19 public methods of the façade keep their legacy semantics byte-identical after the Lot 6.1 switchover.
The command never touches production data: it spins up its own
ephemeral database (arangodb_facade_test_<random>) and drops it on
cleanup. The cleanup runs in a finally block so the database is
dropped even on unexpected exception. Pass --no-cleanup to keep
the database around for post-mortem inspection.
Coverage matrix:
| Step | Façade surface |
|---|---|
| 0 | (setup) ArangoClient + ephemeral database + ArangoDB façade |
| 1 | CollectionManagementTrait: collectionCreate / Exists / Rename / Truncate / Drop |
| 2 | CollectionManagementTrait: createIndex (with legacy IndexOptions) + getIndex + getIndexes + dropIndex |
| 3 | ArangoDB: prepare / execute / getCursor / getDocuments |
| 4 | ArangoDB: getFirstResult / getObject / getResult |
| 5 | ArangoDB: streamDocuments |
| 6 | ArangoDB: getFoundRows + getExtra (with fullCount: true → root/nested option splitting) |
| 7 | ArangoDB: invalid AQL surfaces as oihana\arango\clients\exceptions\ArangoException |
Usage:
composer test:facade
composer test:facade -- --step=1-3
composer test:facade -- --step=6
composer test:facade -- --no-cleanup --endpoint=tcp://127.0.0.1:8529
# Long form (equivalent — bypasses Composer):
php bin/console.php command:arango:test:facade --step=6
Tags
Table of Contents
Constants
- ARANGO_CONFIG : string = 'arangoConfig'
- DI key carrying the `[arango]` configuration array.
- MAX_STEP : int = 8
- Total number of business steps exposed by the `--step` option.
- NAME : string = 'command:arango:test:facade'
- The default name of the command.
- OPTION_DATABASE : string = 'database'
- OPTION_ENDPOINT : string = 'endpoint'
- OPTION_NO_CLEANUP : string = 'no-cleanup'
- OPTION_PASSWORD : string = 'password'
- OPTION_STEP : string = 'step'
- Name of the `--step` option used to select a subset of steps to run.
- OPTION_USER : string = 'user'
- TEST_DB_PREFIX : string = 'arangodb_facade_test_'
- Prefix of the ephemeral database created for the run.
Properties
- $arangoConfig : array<string, mixed>
- Resolved configuration array, captured at construction time.
Methods
- __construct() : mixed
- 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.
- configure() : void
- Configures the current command.
- configureArangoTestOptions() : void
- Adds the trait's CLI options to the consuming command.
- execute() : int
- Executes the current command.
- initializeArangoTestClient() : void
- Captures the `[arango]` configuration injected through the command's `init` array. Called from the consuming command's constructor.
- runCleanup() : void
-
runSetup()
: array{0: int, 1: int, 2: array
} - Creates the ephemeral database via the low-level client, then instantiates an {@see ArangoDB} façade pointing at it.
-
runStep1()
: array{0: int, 1: int, 2: array
} -
runStep2()
: array{0: int, 1: int, 2: array
} -
runStep3()
: array{0: int, 1: int, 2: array
} -
runStep4()
: array{0: int, 1: int, 2: array
} -
runStep5()
: array{0: int, 1: int, 2: array
} -
runStep6()
: array{0: int, 1: int, 2: array
} -
runStep7()
: array{0: int, 1: int, 2: array
} - runStep8() : array<string|int, mixed>
- Exercises the auth passthrough exposed on the façade in Lot 6.2c: - `login(user, password)` returns a JWT, the façade now talks to the server through that JWT, - `useBearerAuth(null)` falls back to the configured basic credentials, - `useBasicAuth(user, password)` switches identity at runtime.
- shouldCleanup() : bool
- Returns true when `--no-cleanup` is NOT set.
- seedItems() : void
- (Re)creates the given collection and seeds it with `$count` rows of shape `{ index: N }`.
- 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.
MAX_STEP
Total number of business steps exposed by the `--step` option.
public
int
MAX_STEP
= 8
NAME
The default name of the command.
public
string
NAME
= 'command:arango:test:facade'
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_STEP
Name of the `--step` option used to select a subset of steps to run.
public
string
OPTION_STEP
= 'step'
OPTION_USER
public
string
OPTION_USER
= 'user'
TEST_DB_PREFIX
Prefix of the ephemeral database created for the run.
private
string
TEST_DB_PREFIX
= 'arangodb_facade_test_'
Properties
$arangoConfig
Resolved configuration array, captured at construction time.
protected
array<string, mixed>
$arangoConfig
= []
Methods
__construct()
public
__construct(string|null $name[, Container|null $container = null ][, array<string|int, mixed> $init = [] ]) : mixed
Parameters
- $name : string|null
- $container : Container|null = null
- $init : array<string|int, mixed> = []
Tags
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}configure()
Configures the current command.
protected
configure() : void
configureArangoTestOptions()
Adds the trait's CLI options to the consuming command.
protected
configureArangoTestOptions() : void
execute()
Executes the current command.
protected
execute(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
Tags
Return values
intinitializeArangoTestClient()
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>
runCleanup()
protected
runCleanup(SymfonyStyle $io, ArangoClient $client, array<string|int, mixed> $state) : void
Parameters
- $io : SymfonyStyle
- $client : ArangoClient
- $state : array<string|int, mixed>
runSetup()
Creates the ephemeral database via the low-level client, then instantiates an {@see ArangoDB} façade pointing at it.
protected
runSetup(SymfonyStyle $io, ArangoClient $client, InputInterface $input, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $client : ArangoClient
- $input : InputInterface
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Tags
Return values
array{0: int, 1: int, 2: arrayrunStep1()
protected
runStep1(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Return values
array{0: int, 1: int, 2: arrayrunStep2()
protected
runStep2(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Tags
Return values
array{0: int, 1: int, 2: arrayrunStep3()
protected
runStep3(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Tags
Return values
array{0: int, 1: int, 2: arrayrunStep4()
protected
runStep4(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Tags
Return values
array{0: int, 1: int, 2: arrayrunStep5()
protected
runStep5(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Tags
Return values
array{0: int, 1: int, 2: arrayrunStep6()
protected
runStep6(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Tags
Return values
array{0: int, 1: int, 2: arrayrunStep7()
protected
runStep7(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array{0: int, 1: int, 2: array}
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Return values
array{0: int, 1: int, 2: arrayrunStep8()
Exercises the auth passthrough exposed on the façade in Lot 6.2c: - `login(user, password)` returns a JWT, the façade now talks to the server through that JWT, - `useBearerAuth(null)` falls back to the configured basic credentials, - `useBasicAuth(user, password)` switches identity at runtime.
protected
runStep8(SymfonyStyle $io, array<string|int, mixed> $state, int $passed, int $errors) : array<string|int, mixed>
Skipped (with a single passing assertion explaining why) when no
basic credentials are configured — /_open/auth requires them.
Parameters
- $io : SymfonyStyle
- $state : array<string|int, mixed>
- $passed : int
- $errors : int
Return values
array<string|int, mixed>shouldCleanup()
Returns true when `--no-cleanup` is NOT set.
protected
shouldCleanup(InputInterface $input) : bool
Parameters
- $input : InputInterface
Return values
boolseedItems()
(Re)creates the given collection and seeds it with `$count` rows of shape `{ index: N }`.
private
seedItems(ArangoDB $db, string $name, int $count) : void
Parameters
- $db : ArangoDB
- $name : string
- $count : int
Tags
stringOption()
Reads a string CLI option, returning null when missing or empty.
private
stringOption(InputInterface $input, string $name) : string|null
Parameters
- $input : InputInterface
- $name : string