shouldReceive('isRegistered') ->andReturnUsing(function ($name) { echo "Mock called: isRegistered('$name')\n"; return $name === 'counter'; }); $liveComponentRegistry->shouldReceive('getClassName') ->andReturnUsing(function ($name) { echo "Mock called: getClassName('$name')\n"; return 'TestCounter'; }); $liveComponentRegistry->shouldReceive('resolve') ->andReturnUsing(function () { echo "Mock called: resolve(...)\n"; throw new \Exception("Unexpected call to resolve"); }); $htmlComponentRegistry->shouldReceive('has') ->andReturnUsing(function ($name) { echo "Mock called: htmlComponentRegistry->has('$name')\n"; return false; }); $processor = new XComponentProcessor( $liveComponentRegistry, $htmlComponentRegistry, $metadataCache, new DomComponentService() ); $html = '