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
services()
[\Override]
public function services(): array
PHPDoc:
@return list<ServiceDefinition>
resolve()
[\Override]
public function resolve(string $type, array $attributes): ?object
PHPDoc:
@param class-string $type@param list<object> $attributes
beforeTest()
[\Override]
public function beforeTest(TestContext $context): void
afterTest()
[\Override]
public function afterTest(TestContext $context, TestResult $result): TestResult
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
$id
public string $id;
PHPDoc:
@var non-empty-string
__construct()
public function __construct(string $id)
PHPDoc:
@throws \InvalidArgumentException
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
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';
configure()
public function configure(array $configuration): void
PHPDoc:
@param mixed[] $configuration
getRuleDefinition()
public function getRuleDefinition(): RuleDefinition
getNodeTypes()
public function getNodeTypes(): array
PHPDoc:
@return array<class-string<Node>>
refactor()
public function refactor(Node $node): ?Node
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
$id
public string $id;
PHPDoc:
@var non-empty-string
__construct()
public function __construct(string $id)
PHPDoc:
@throws \InvalidArgumentException
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
services()
[\Override]
public function services(): array
PHPDoc:
@return list<ServiceDefinition>
resolve()
[\Override]
public function resolve(string $type, array $attributes): ?object
PHPDoc:
@param class-string $type@param list<object> $attributes
beforeTest()
[\Override]
public function beforeTest(TestContext $context): void
afterTest()
[\Override]
public function afterTest(TestContext $context, TestResult $result): TestResult