diff --git a/audit.php b/audit.php index dffed41..f4f3291 100644 --- a/audit.php +++ b/audit.php @@ -24,6 +24,7 @@ chdir('../../'); include_once('./include/auth.php'); +include_once('./plugins/audit/ui_helpers.php'); set_default_action(); @@ -35,9 +36,7 @@ case 'purge': audit_purge(); - top_header(); - audit_log(); - bottom_footer(); + audit_render_with_layout('audit_log'); break; case 'getdata': @@ -132,9 +131,7 @@ break; default: - top_header(); - audit_log(); - bottom_footer(); + audit_render_with_layout('audit_log'); } function audit_purge() { @@ -463,4 +460,3 @@ function audit_log() { content->bottom', $events === array('top_header', 'content', 'bottom_footer')); + +$source = file_get_contents(__DIR__ . '/../audit.php'); + +assert_true( + 'purge/default actions use shared layout helper', + substr_count($source, "audit_render_with_layout('audit_log');") >= 2 +); +assert_true( + 'audit.php includes ui helper file', + strpos($source, "include_once('./plugins/audit/ui_helpers.php');") !== false +); + +echo "\n"; +echo "Results: $pass passed, $fail failed\n"; + +exit($fail > 0 ? 1 : 0); diff --git a/ui_helpers.php b/ui_helpers.php new file mode 100644 index 0000000..767356f --- /dev/null +++ b/ui_helpers.php @@ -0,0 +1,19 @@ +