id = $id; } public function Id() { return $this->id; } public function Name() { return 'Event <42> & "front"'; } public function canView() { return true; } } } namespace { $root = isset($argv[1]) ? $argv[1] : __DIR__.'/../../web'; $file = $root.'/skins/classic/views/frames.php'; $stubdir = sys_get_temp_dir().'/zm_frames_link_stubs_'.getmypid(); @mkdir($stubdir.'/includes', 0700, true); file_put_contents($stubdir.'/includes/Frame.php', " '42'); $view = 'frames'; ob_start(); include $file; $html = ob_get_clean(); $failures = 0; function check($name, $ok) { global $failures; echo ($ok ? 'ok' : 'FAIL')." - $name\n"; if (!$ok) $failures++; } check('the toolbar links to the event', (bool)preg_match('/]*href="\?view=event&eid=42"/', $html)); check('the link names the event, escaped', strpos($html, 'title="ViewEvent: Event <42> & "front""') !== false); @unlink($stubdir.'/includes/Frame.php'); @unlink($stubdir.'/includes/Filter.php'); @rmdir($stubdir.'/includes'); @rmdir($stubdir); echo $failures ? "\n$failures check(s) FAILED\n" : "\nall checks passed\n"; exit($failures ? 1 : 0); }