-
-
Notifications
You must be signed in to change notification settings - Fork 478
Expand file tree
/
Copy pathtest_expiration_of_zero.php
More file actions
42 lines (32 loc) · 947 Bytes
/
test_expiration_of_zero.php
File metadata and controls
42 lines (32 loc) · 947 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
38
39
40
41
42
<?php
$backupDirectory = './TestDest/';
chdir(__DIR__);
exec('rm -rf ./TestDest');
include 'populate_dest.php';
exec('../rsync_tmbackup.sh --strategy "1:1 30:x" ./TestSource/ ' . $backupDirectory, $output, $return);
if ($return !== 0) {
echo 'Invalid return code';
echo implode(PHP_EOL, $output);
exit(1);
}
$backups = array_filter(
scandir($backupDirectory),
function ($file) use ($backupDirectory) {
return is_dir($backupDirectory . $file) && !in_array($file, ['.', '..']);
}
);
$expected = 33;
if (count($backups) !== $expected) {
echo 'Given this strategy there should be ' . $expected . ' directories. But ' . count($backups) . ' directories found.';
echo 'Found directories:';
echo implode(
PHP_EOL,
array_map(
function ($directory) { return "- {$directory}"; },
$backups
)
);
exit(1);
}
echo 'All assertions succeeded';
exit(0);