Skip to content

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.

class LightweightTestContainer

SourceTesting/LightweightTestContainer.php

public function __construct(): mixed

Returns mixed

MethodDescription
appendAttribute(string $name, mixed $value): void
appendAttributeByRef(string $name, mixed &$value): void
clearArguments(): voidDrops the stored argument snapshot, so getArguments() reports null again rather than an empty array.
clearAttributes(): voidRemoves every attribute, leaving getAttributeNames() empty.
[`getArguments(): array<string, mixed>null`](#getarguments)
getAttribute(string $name, mixed $namespace = null, mixed $default = null): mixed
getAttributeNames(): array<string>
getAttributes(): array<string, mixed>
getRequestMethod(): stringReturns the request method the container was told to report; read until setRequestMethod() says otherwise.
getValidationManager(): objectReturns the validation manager, building a stub on first access if none was injected.
hasAttribute(string $name, mixed $namespace = null): bool
removeAttribute(string $name): mixed
setArguments(array<string, mixed> $args): void
setAttribute(string $name, mixed $value): void
setAttributeByRef(string $name, mixed &$value): void
setAttributes(array<string, mixed> $attributes): void
setAttributesByRef(array<string, mixed> &$attributes): void
setRequestMethod(string $method): voidSets the request method getRequestMethod() reports.
setValidationManager(object $vm): voidInjects the validation manager getValidationManager() returns.

public function appendAttribute(string $name, mixed $value): void

ParameterTypeDescription
$namestring
$valuemixed

public function appendAttributeByRef(string $name, mixed &$value): void

ParameterTypeDescription
$namestring
$valuemixed

public function clearArguments(): void

Drops the stored argument snapshot, so getArguments() reports null again rather than an empty array.

public function clearAttributes(): void

Removes every attribute, leaving getAttributeNames() empty.

The request method and stored arguments are untouched.

public function getArguments(): array<string, mixed>|null

Returns array``<``string``, ``mixed``>``|``null

public function getAttribute(string $name, mixed $namespace = null, mixed $default = null): mixed

ParameterTypeDescription
$namestring
$namespacemixed
$defaultmixed

Returns mixed

public function getAttributeNames(): array<string>

Returns array``<``string``>

public function getAttributes(): array<string, mixed>

Returns array``<``string``, ``mixed``>

public function getRequestMethod(): string

Returns the request method the container was told to report; read until setRequestMethod() says otherwise.

Returns string

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

public function hasAttribute(string $name, mixed $namespace = null): bool

ParameterTypeDescription
$namestring
$namespacemixed

Returns bool

public function removeAttribute(string $name): mixed

ParameterTypeDescription
$namestring

Returns mixed

public function setArguments(array<string, mixed> $args): void

ParameterTypeDescription
$argsarray``<``string``, ``mixed``>

public function setAttribute(string $name, mixed $value): void

ParameterTypeDescription
$namestring
$valuemixed

public function setAttributeByRef(string $name, mixed &$value): void

ParameterTypeDescription
$namestring
$valuemixed

public function setAttributes(array<string, mixed> $attributes): void

ParameterTypeDescription
$attributesarray``<``string``, ``mixed``>

public function setAttributesByRef(array<string, mixed> &$attributes): void

ParameterTypeDescription
$attributesarray``<``string``, ``mixed``>

public function setRequestMethod(string $method): void

Sets the request method getRequestMethod() reports.

The value is stored verbatim; nothing validates or normalizes it.

ParameterTypeDescription
$methodstring

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.

ParameterTypeDescription
$vmobject