-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.php
More file actions
50 lines (44 loc) · 1.17 KB
/
tests.php
File metadata and controls
50 lines (44 loc) · 1.17 KB
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
43
44
45
46
47
48
49
50
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require('driveup.php');
require('logger.php');
function loggerTest() {
print 'RUNNING LOG TEST...<br>';
$log = new Log();
$log->write('Writing a test line to log.');
}
function runUploadTest() {
print 'RUNNING UPLOAD TO DRIVE TEST...<br>';
$filePath = getcwd().'/uploads/testblob.webm';
$r = uploadToDrive($filePath);
echo '<pre>';
print_r($r);
echo '</pre>';
if($r['name'] == basename($filePath)) {
print 'UPLOAD TO DRIVE - PASSED<br>';
}
else {
print 'UPLOAD TO DRIVE - FAILED<br>';
}
}
function canWriteTest() {
print 'RUNNING CAN WRITE TO UPLOAD FOLDER TEST...<br>';
$url = $filePath = getcwd().'/uploads';
if (!is_writable($url)) {
try {
chmod($url, 0644);
} catch (Exception $e) {
print $e->getMessage() . ' | File : ' . $url . ' | Needs write permission [0644] to process !<br>';
print 'CAN WRITE TO UPLOAD FOLDER - FAILED<br>';
}
print 'CAN WRITE TO UPLOAD FOLDER - PASSED<br>';
}
else {
print 'CAN WRITE TO UPLOAD FOLDER - PASSED<br>';
}
}
// Tests to run
canWriteTest();
loggerTest();
runUploadTest();