-
-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathspx_ui_report_delete_all.phpt
More file actions
37 lines (31 loc) · 920 Bytes
/
Copy pathspx_ui_report_delete_all.phpt
File metadata and controls
37 lines (31 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
UI: delete all reports
--INI--
spx.http_enabled=1
spx.http_key="dev"
spx.http_ip_whitelist="127.0.0.1"
spx.data_dir="{PWD}/tmp_data_dir_delete_all"
log_errors=on
--FILE--
<?php
$dataDir = ini_get('spx.data_dir');
$clean = function () use ($dataDir) { exec(sprintf('rm -rf %s', escapeshellarg($dataDir))); };
$clean();
@mkdir($dataDir);
foreach (['foo', 'bar', 'baz'] as $report) {
file_put_contents("$dataDir/$report.json", $report);
file_put_contents("$dataDir/$report.txt.gz", $report);
file_put_contents("$dataDir/$report.txt.zst", $report);
}
file_put_contents("$dataDir/keep.txt", 'keep');
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_GET['SPX_KEY'] = 'dev';
$_GET['SPX_UI_URI'] = '/data/reports/delete_all';
spx_ui_handle_request();
echo "Remaining files:\n", implode("\n", glob("$dataDir/*"));
$clean();
?>
--EXPECTF--
{"success": true}
Remaining files:
%s/tmp_data_dir_delete_all/keep.txt