3 require_once 'FSTools/FileSystemHarness.php';
6 * These are not really unit tests, just sanity checks of basic functionality.
8 class FSTools_FileTest
extends FSTools_FileSystemHarness
11 public function test()
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');
20 $this->assertFalse($file->exists());
23 public function testGetNonExistent()
25 $name = 'notfound.txt';
26 $file = new FSTools_File($name);
28 $this->assertFalse($file->get());
31 public function testHandle()
33 $file = new FSTools_File('foo.txt');
34 $this->assertFalse($file->exists());
36 $this->assertTrue($file->exists());
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());