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 = ''; echo "Input: $html\n\n"; $parser = new DomTemplateParser(); $dom = $parser->parseToWrapper($html); echo "Parsed: " . $dom->document->saveHTML() . "\n\n"; $context = new RenderContext( template: 'test', metaData: new MetaData('Test'), data: [] ); echo "Processing...\n"; try { $result = $processor->process($dom, $context); echo "Result: " . $result->document->saveHTML() . "\n"; } catch (\Throwable $e) { echo "ERROR: " . $e->getMessage() . "\n"; echo $e->getTraceAsString() . "\n"; }