Browse documentation

Integration API

This reference lists public integration types for Laravel, Rector, and Symfony.

These signatures are the public API.

LaravelPlugin

Namespace: Greenlight\Laravel

Boots one Laravel application lazily for a test and resolves bound services. #[Service] selects an explicit binding ID. Tests MUST isolate external resources by GREENLIGHT_CHANNEL.

final class LaravelPlugin implements HarnessProvider, ServiceResolver, TestLifecycleSubscriber

View source

services()

[\Override]
public function services(): array

PHPDoc:

View source

resolve()

[\Override]
public function resolve(string $type, array $attributes): ?object

PHPDoc:

View source

beforeTest()

[\Override]
public function beforeTest(TestContext $context): void

View source

afterTest()

[\Override]
public function afterTest(TestContext $context, TestResult $result): TestResult

View source

Laravel\Service

Namespace: Greenlight\Laravel

Use when the parameter type is not a unique container binding. The resolved service must still satisfy the declared type.

#[\Attribute(\Attribute::TARGET_PARAMETER)]
final readonly class Service

View source

$id

public string $id;

PHPDoc:

View source

__construct()

public function __construct(string $id)

PHPDoc:

View source

PhpUnitToGreenlightRector

Namespace: Greenlight\Rector

Converts a final PHPUnit test class to Greenlight: the TestCase parent, lifecycle hooks, attributes, assertions, and expectException() blocks. The rule converts a class only when every member has a faithful Greenlight equivalent. It does not change other classes.

final class PhpUnitToGreenlightRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface

View source

DROP_ASSERTION_MESSAGES

Configuration key: remove PHPUnit failure-message arguments. Without this option, a custom message rejects the class. Greenlight expectations carry no custom message.

public const string DROP_ASSERTION_MESSAGES = 'drop_assertion_messages';

View source

configure()

public function configure(array $configuration): void

PHPDoc:

View source

getRuleDefinition()

public function getRuleDefinition(): RuleDefinition

View source

getNodeTypes()

public function getNodeTypes(): array

PHPDoc:

View source

refactor()

public function refactor(Node $node): ?Node

View source

Symfony\Service

Namespace: Greenlight\Symfony

If the parameter type is not a unique container ID, use #[Service]. The resolved service must have the declared type.

#[\Attribute(\Attribute::TARGET_PARAMETER)]
final readonly class Service

View source

$id

public string $id;

PHPDoc:

View source

__construct()

public function __construct(string $id)

PHPDoc:

View source

SymfonyPlugin

Namespace: Greenlight\Symfony

Greenlight boots the kernel when it is first necessary. The kernel then stays active for the worker lifetime.

The container must expose Symfony’s test container. If the configuration does not disable resets, the container must expose services_resetter. If a service keeps state between tests, do not disable resets.

#[Service] selects an explicit ID instead of a type-based search. Isolate external resources with GREENLIGHT_CHANNEL.

final class SymfonyPlugin implements HarnessProvider, ServiceResolver, TestLifecycleSubscriber

View source

services()

[\Override]
public function services(): array

PHPDoc:

View source

resolve()

[\Override]
public function resolve(string $type, array $attributes): ?object

PHPDoc:

View source

beforeTest()

[\Override]
public function beforeTest(TestContext $context): void

View source

afterTest()

[\Override]
public function afterTest(TestContext $context, TestResult $result): TestResult

View source