LightweightTestContainer
A minimal stand-in for the execution container, used only by the PHPUnit test harness.
It implements just enough of the attribute and validation-manager surface that tests exercising them — assertContainerAttribute*, argument validation assertions — run without fatally erroring.
Scope: - Attribute holder semantics. Namespaces are ignored; tests in this codebase use a null namespace consistently. Supporting them would mean storing nested arrays. - Request method storage (setRequestMethod/getRequestMethod), for reflective test usage. - A validation manager stub exposing getReport() with the two methods ActionTestCase reads: isArgumentValidated() and isArgumentFailed().
The validation report answers false to every query. A test expecting a validated argument therefore fails rather than silently passing, which points at the missing emulation instead of hiding it.
Synopsis
Section titled “Synopsis”class LightweightTestContainer
| Source | Testing/LightweightTestContainer.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(): mixed
Returns mixed
Methods
Section titled “Methods”appendAttribute()
Section titled “appendAttribute()”public function appendAttribute(string $name, mixed $value): void
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | mixed |
appendAttributeByRef()
Section titled “appendAttributeByRef()”public function appendAttributeByRef(string $name, mixed &$value): void
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | mixed |
clearArguments()
Section titled “clearArguments()”public function clearArguments(): void
Drops the stored argument snapshot, so getArguments() reports null again rather than an empty array.
clearAttributes()
Section titled “clearAttributes()”public function clearAttributes(): void
Removes every attribute, leaving getAttributeNames() empty.
The request method and stored arguments are untouched.
getArguments()
Section titled “getArguments()”public function getArguments(): array<string, mixed>|null
Returns array``<``string``, ``mixed``>``|``null
getAttribute()
Section titled “getAttribute()”public function getAttribute(string $name, mixed $namespace = null, mixed $default = null): mixed
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$namespace | mixed | |
$default | mixed |
Returns mixed
getAttributeNames()
Section titled “getAttributeNames()”public function getAttributeNames(): array<string>
Returns array``<``string``>
getAttributes()
Section titled “getAttributes()”public function getAttributes(): array<string, mixed>
Returns array``<``string``, ``mixed``>
getRequestMethod()
Section titled “getRequestMethod()”public function getRequestMethod(): string
Returns the request method the container was told to report; read until setRequestMethod() says otherwise.
Returns string
getValidationManager()
Section titled “getValidationManager()”public function getValidationManager(): object
Returns the validation manager, building a stub on first access if none was injected.
The stub is created lazily and kept, so the same instance — and the same report — is returned on every call. Its report answers false to every query, so a test that expects an argument to have been validated fails rather than passing on emulation.
Returns object
hasAttribute()
Section titled “hasAttribute()”public function hasAttribute(string $name, mixed $namespace = null): bool
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$namespace | mixed |
Returns bool
removeAttribute()
Section titled “removeAttribute()”public function removeAttribute(string $name): mixed
| Parameter | Type | Description |
|---|---|---|
$name | string |
Returns mixed
setArguments()
Section titled “setArguments()”public function setArguments(array<string, mixed> $args): void
| Parameter | Type | Description |
|---|---|---|
$args | array``<``string``, ``mixed``> |
setAttribute()
Section titled “setAttribute()”public function setAttribute(string $name, mixed $value): void
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | mixed |
setAttributeByRef()
Section titled “setAttributeByRef()”public function setAttributeByRef(string $name, mixed &$value): void
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | mixed |
setAttributes()
Section titled “setAttributes()”public function setAttributes(array<string, mixed> $attributes): void
| Parameter | Type | Description |
|---|---|---|
$attributes | array``<``string``, ``mixed``> |
setAttributesByRef()
Section titled “setAttributesByRef()”public function setAttributesByRef(array<string, mixed> &$attributes): void
| Parameter | Type | Description |
|---|---|---|
$attributes | array``<``string``, ``mixed``> |
setRequestMethod()
Section titled “setRequestMethod()”public function setRequestMethod(string $method): void
Sets the request method getRequestMethod() reports.
The value is stored verbatim; nothing validates or normalizes it.
| Parameter | Type | Description |
|---|---|---|
$method | string |
setValidationManager()
Section titled “setValidationManager()”public function setValidationManager(object $vm): void
Injects the validation manager getValidationManager() returns.
Call this before the first getValidationManager() to keep the always-false stub from being built; calling it afterwards replaces the stub for subsequent reads. Any object exposing getReport() is accepted — the container never inspects it.
| Parameter | Type | Description |
|---|---|---|
$vm | object |