Diff Expected Actual HTML; $htmlPath = $targetDir.'/it_matches_home_desktop.html'; file_put_contents($htmlPath, $html); $written = MismatchScreenshotExporter::export($htmlPath, $targetDir); expect($written)->toHaveCount(3); expect($written)->toContain($targetDir.'/it_matches_home_desktop-diff.png'); expect($written)->toContain($targetDir.'/it_matches_home_desktop-expected.png'); expect($written)->toContain($targetDir.'/it_matches_home_desktop-actual.png'); expect(base64_decode($diff, true))->toBe((string) file_get_contents($targetDir.'/it_matches_home_desktop-diff.png')); expect(base64_decode($expected, true))->toBe((string) file_get_contents($targetDir.'/it_matches_home_desktop-expected.png')); expect(base64_decode($actual, true))->toBe((string) file_get_contents($targetDir.'/it_matches_home_desktop-actual.png')); }); it('returns an empty list when the html has no embedded images', function (): void { $targetDir = sys_get_temp_dir().'/mismatch-exporter-'.uniqid(); mkdir($targetDir, 0755, true); $htmlPath = $targetDir.'/plain.html'; file_put_contents($htmlPath, 'no images'); expect(MismatchScreenshotExporter::export($htmlPath, $targetDir))->toBe([]); });