Make URI parsing algorithm more strict.
[htmlpurifier.git] / tests / FSTools / FileTest.php
blobe9b703a2db009f510e18091a3ccb19ad1fe3cc43
1 <?php
3 require_once 'FSTools/FileSystemHarness.php';
5 /**
6 * These are not really unit tests, just sanity checks of basic functionality.
7 */
8 class FSTools_FileTest extends FSTools_FileSystemHarness
11 function test() {
12 $name = 'test.txt';
13 $file = new FSTools_File($name);
14 $this->assertFalse($file->exists());
15 $file->write('foobar');
16 $this->assertTrue($file->exists());
17 $this->assertEqual($file->get(), 'foobar');
18 $file->delete();
19 $this->assertFalse($file->exists());
22 function testGetNonExistent() {
23 $name = 'notfound.txt';
24 $file = new FSTools_File($name);
25 $this->expectError();
26 $this->assertFalse($file->get());
29 function testHandle() {
30 $file = new FSTools_File('foo.txt');
31 $this->assertFalse($file->exists());
32 $file->open('w');
33 $this->assertTrue($file->exists());
34 $file->put('Foobar');
35 $file->close();
36 $file->open('r');
37 $this->assertIdentical('F', $file->getChar());
38 $this->assertFalse($file->eof());
39 $this->assertIdentical('oo', $file->read(2));
40 $this->assertIdentical('bar', $file->getLine());
41 $this->assertTrue($file->eof());
46 // vim: et sw=4 sts=4