PSR-2 reformatting PHPDoc corrections
[htmlpurifier.git] / tests / FSTools / FileTest.php
blob5952dcd57f8968059a34be9a022c79da45dbe45e
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 public function test()
13 $name = 'test.txt';
14 $file = new FSTools_File($name);
15 $this->assertFalse($file->exists());
16 $file->write('foobar');
17 $this->assertTrue($file->exists());
18 $this->assertEqual($file->get(), 'foobar');
19 $file->delete();
20 $this->assertFalse($file->exists());
23 public function testGetNonExistent()
25 $name = 'notfound.txt';
26 $file = new FSTools_File($name);
27 $this->expectError();
28 $this->assertFalse($file->get());
31 public function testHandle()
33 $file = new FSTools_File('foo.txt');
34 $this->assertFalse($file->exists());
35 $file->open('w');
36 $this->assertTrue($file->exists());
37 $file->put('Foobar');
38 $file->close();
39 $file->open('r');
40 $this->assertIdentical('F', $file->getChar());
41 $this->assertFalse($file->eof());
42 $this->assertIdentical('oo', $file->read(2));
43 $this->assertIdentical('bar', $file->getLine());
44 $this->assertTrue($file->eof());
49 // vim: et sw=4 sts=4