-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.php
More file actions
61 lines (48 loc) · 1.63 KB
/
tests.php
File metadata and controls
61 lines (48 loc) · 1.63 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
51
52
53
54
55
56
57
58
59
60
61
<?php
// Lets include our Test Library
include_once('classes/Test.class.php');
// Lets include our Class to test it
include_once('classes/Data.class.php');
$test = new Test();
$data = new Data();
/**
* Show test results with different inputs
* @param class $class class of which method to be tested
* @param string $method name of method of the class
* @param string $expectedOutput output that is expected
* @param int $numberOfParams number of params in method. Default: 1
* @param array $additionalData additional data to test. (optional)
**/
$test->result( $data, 'validateFileEncoding', 'boolean', '1' );
$test->result( $data, 'validateFileDelimiter', 'boolean', '2' );
$test->result( $data, 'validateDate', 'boolean', '2' );
$test->result( $data, 'getFileHeader', 'boolean', '1' );
$test->result( $data, 'getFileData', 'boolean', '2' );
$test->result( $data, 'validateFileData', 'boolean', '3' );
/**
* ParamFormat eg.
* array(array("string" => "This is a string data."),
* array("int" => 1),
* array("float" => 2.0),
* array("array" => array()),
* array("bool" => false)
* );
*
* For additionalData values, Following are the variable types
* "boolean"
* "integer"
* "double" (for historical reasons "double" is returned in case of a float, and not simply "float")
* "string"
* "array"
* "object"
* "resource"
* "resource (closed)" as of PHP 7.2.0
* "NULL"
* "unknown type"
**/
$additionalData = array(array('string' => 'Check these characters $$ %% ** {}',
array('object' => $data))
);
$test->result( $data, 'isFloat', 'boolean', '1', $additionalData );
?>
</pre>