InteractsWithAop
trait InteractsWithAop
Provides a test helper for invoking a method through the AOP pipeline without relying on generated proxies.
In full application or Testbench integration tests, AOP proxies may already be generated and those tests should call the target method normally. This trait is for tests where the target is not already proxied, or where the goal is to exercise aspect pipeline behavior directly.
callWithAspects() invokes the same dispatcher used by generated proxies before calling the original method via reflection.
Methods
Determine if the given instance is already running through an AOP proxy.
Call a method through the registered AOP aspect pipeline.
Details
at line 34
protected bool
isAopProxied(object $instance)
Determine if the given instance is already running through an AOP proxy.
Call generated proxies normally. Use callWithAspects() only for focused tests that register aspects directly without generating proxies; it does not bypass bootstrap's rejection of targets loaded before generation.
at line 54
protected mixed
callWithAspects(object $instance, string $method, array $arguments = [])
Call a method through the registered AOP aspect pipeline.
Builds a ProceedingJoinPoint for the given instance and method, resolves matching aspects from AspectCollector, and executes them in priority order. The original method is called via reflection at the end of the pipeline. The instance must not already be proxied.
After application bootstrap, call {\Hypervel\Di\Aop\AspectCollector::unseal()} before registering aspects for this helper.