forked from BorderCloud/TFT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbstractTest.php
72 lines (64 loc) · 1.61 KB
/
AbstractTest.php
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Created by PhpStorm.
* User: karima
* Date: 10/08/18
* Time: 13:41
*/
abstract class abstractTest
{
protected $_errors;
protected $_fails;
protected $_time = 0;
function __construct()
{
$this->_errors = array();
$this->_fails = array();
}
function AddError($error) {
if (!in_array($error, $this->_errors)) {
$this->_errors[] = $error;
}
return true;
}
function AddFail($fail) {
if (!in_array($fail, $this->_errors)) {
$this->_fails[] = $fail;
}
return true;
}
function GetErrors() {
return $this->_errors;
}
function ResetErrors() {
$this->_errors = array();
}
function GetFails() {
return $this->_fails;
}
function ResetFails() {
$this->_fails = array();
}
function GetTime() {
return $this->_time;
}
public function LoadContentFile($urlToDownload){
global $listTestSuite;
$file = "";
foreach ($listTestSuite as $URL => $folder) {
if (0 === strpos($urlToDownload, $URL)) {
$file0 = str_replace($URL, $folder, $urlToDownload);
$file = str_replace("manifest#", "", $file0);
}
}
if (empty($file)) {
$this->AddFail($urlToDownload. " is unknown in the testsuite of the config.ini.");
return "";
}
if (!file_exists($file)) {
$this->AddFail("File ".$file." of this query doesn't exist.");
return "";
}
return file_get_contents($file);
}
}