-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibFileSystemTest.php
More file actions
48 lines (36 loc) · 1.64 KB
/
Copy pathLibFileSystemTest.php
File metadata and controls
48 lines (36 loc) · 1.64 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
<?php
/**
* LibFileSystemTest - Unit test for LibFileSystem.
* @author James Clayton <james.r.clayton@gmail.com>
* @version 0.0.1
* @copyright (c) 2013, James Clayton
* @package LibFileSystemTest
* @license http://opensource.org/licenses/ISC ISC License (ISC)
*/
include_once('../LibEasyPHP/LibConfig.php');
$html->PrintLine('LibFileSystemTest - Unit test for LibFileSystem.', '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('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');
$html->PrintLine('String replace: ' . $str->Replace(array('file', 'written'), array('butt', 'farted'), $ReadFile), 'p');
?>