-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibStringTest.php
More file actions
63 lines (46 loc) · 2.41 KB
/
Copy pathLibStringTest.php
File metadata and controls
63 lines (46 loc) · 2.41 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
62
63
<?php
/**
* LibStringTest - Unit test for LibString.
* @author James Clayton <james.r.clayton@gmail.com>
* @version 0.0.1
* @copyright (c) 2013, James Clayton
* @package LibStringTest
* @license http://opensource.org/licenses/ISC ISC License (ISC)
*/
include_once('../LibEasyPHP/LibConfig.php');
$html->PrintLine('LibStringTest - Unit test for LibString.', 'p');
$html->PrintLine('The current date and time: ' . $date->Today('Long'), 'p');
$HelloWorldFile = 'C:/HelloWorld.txt';
$HelloWorldMessage = ('This file was written on: ' . $date->Today('Long'));
if($fs->FileExists($HelloWorldFile)) {
$html->PrintLine('The file does exist: ' . $HelloWorldFile, 'p');
} elseif(!$fs->FileExists($HelloWorldFile)) {
$html->PrintLine('The file does not exist: ' . $HelloWorldFile, 'p');
$fs->WriteDataToFile($HelloWorldFile, $HelloWorldMessage);
if($fs->FileExists($HelloWorldFile)) {
$html->PrintLine('Originally, this file did not exist. But, it was written: ' . $HelloWorldFile, 'p');
} else {
$html->PrintLine('This file does not exist. Even after I attempted to write: ' . $HelloWorldFile, 'p');
}
} else {
$html->PrintLine('Else. Undecided!', 'p');
}
if($fs->FileExists($HelloWorldFile)) {
$ReadFile = $fs->ReadFileIntoString($HelloWorldFile);
$html->PrintLine('Attempting to read file: ' . $ReadFile, 'p');
}
$html->PrintLine('This file was changed on: ' . $date->DateFormat($fs->FileChangeTime($HelloWorldFile), 'Long'), 'p');
$html->PrintLine('This file was modified on: ' . $date->DateFormat($fs->FileModificationTime($HelloWorldFile), 'Long'), 'p');
$html->PrintLine('File Age: ' . $date->DateDiff($date->DateFormat($fs->FileModificationTime($HelloWorldFile), 'Long'), $date->Today(), 'Days') . ' days', 'p');
$html->PrintLine('Word count: ' . $str->WordCount($ReadFile), 'p');
$html->PrintLine('Character count: ' . $str->CharacterCount($ReadFile), 'p');
$html->PrintLine('Rot13: ' . $str->Rot13($ReadFile), 'p');
$html->PrintLine('String shuffle: ' . $str->Shuffle($ReadFile), 'p');
$ButtFart = $html->PrintLine('String replace: ' . $str->Replace(array('file', 'written'), array('butt', 'farted'), $ReadFile), 'p');
$html->PrintLine($dm->StringToArray($ReadFile, ' '), 'br');
//$ReadFileAsArray = $dm->StringToArray($ReadFile, ' ');
//$html->PrintLine($ReadFileAsArray);
//print_r($ReadFileAsArray);
//$html->PrintLine('StringToArray: ' . $ReadFileAsArray, 'br');
//$html->ArrayToHtml($ReadFileAsArray, True, array(1, 2, 3));
?>