'; echo "Input HTML: $html\n\n"; $dom = $parser->parseToWrapper($html); echo "Parsed HTML: " . $dom->document->saveHTML() . "\n\n"; // Check body content $body = $dom->document->getElementsByTagName('body')[0]; echo "Body children: " . $body->childNodes->length . "\n"; foreach ($body->childNodes as $child) { echo " - " . $child->nodeName . " (" . get_class($child) . ")\n"; } echo "\n"; // Mock LiveComponent $mockComponent = Mockery::mock(LiveComponentContract::class); $mockComponent->shouldReceive('getId') ->andReturn(ComponentId::create('counter', 'demo')); $mockComponent->shouldReceive('getData') ->andReturn(ComponentData::fromArray(['initialValue' => 5])); $mockComponent->shouldReceive('getRenderData') ->andReturn(new ComponentRenderData('counter-template', ['value' => 5])); // Setup registry mocks $liveComponentRegistry->shouldReceive('isRegistered') ->with('counter') ->andReturn(true); $liveComponentRegistry->shouldReceive('getClassName') ->with('counter') ->andReturn('TestCounterComponent'); $liveComponentRegistry->shouldReceive('resolve') ->once() ->andReturn($mockComponent); $liveComponentRegistry->shouldReceive('renderWithWrapper') ->with($mockComponent) ->andReturn('
Counter HTML
'); // Mock metadata $mockMetadata = new CompiledComponentMetadata( className: 'TestCounterComponent', componentName: 'counter', properties: [ 'initialValue' => new ComponentPropertyMetadata( name: 'initialValue', type: 'int', isPublic: true, isReadonly: false ) ], actions: [], constructorParams: [] ); $metadataCache->shouldReceive('get') ->with('TestCounterComponent') ->andReturn($mockMetadata); // Process echo "Processing...\n"; $context = new RenderContext( template: 'test-template', metaData: new MetaData('Test Component Processing'), data: [] ); try { $result = $processor->process($dom, $context); echo "Processing successful!\n\n"; $html = $result->document->saveHTML(); echo "Result HTML: $html\n\n"; if (str_contains($html, 'data-component-id="counter:demo"')) { echo "✓ SUCCESS: Contains expected content!\n"; } else { echo "✗ FAIL: Does not contain expected content\n"; } } catch (\Throwable $e) { echo "ERROR: " . $e->getMessage() . "\n"; echo $e->getTraceAsString() . "\n"; }