testStringFileLike.php
1.4 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
<?php
require_once(dirname(__FILE__) . "/../test.php");
require_once(KT_LIB_DIR . '/filelike/stringfilelike.inc.php');
class StringFileLikeTestCase extends KTUnitTestCase {
function testRead() {
$sContents = "asdf";
$f = new KTStringFileLike($sContents);
$sBack = $f->read(64);
}
function testEof() {
$sContents = "asdf";
$f = new KTStringFileLike($sContents);
$sBack = $f->read(64);
$this->assertEqual($f->eof(), true);
}
function testEof2() {
$sContents = "asdf";
$f = new KTStringFileLike($sContents);
$sBack = $f->read(3);
$this->assertEqual($f->eof(), false);
}
function testEof3() {
$sContents = "asdf";
$f = new KTStringFileLike($sContents);
$sBack = $f->read(4);
$this->assertEqual($f->eof(), true);
}
function testShortRead() {
$sContents = "asdf";
$f = new KTStringFileLike($sContents);
$sBack = $f->read(3);
$this->assertEqual($sBack, 'asd');
}
function testGetContents() {
$sContents = "asdf";
$f = new KTStringFileLike($sContents);
$sBack = $f->get_contents();
$this->assertEqual($sBack, $sContents);
}
function testCheckPos() {
$f = new KTStringFileLike($sContents);
$sBack = $f->get_contents();
$this->assertEqual($sBack, $sContents);
}
}
?>