public function testProperties() { $dirname = 'test'; $driver = mockDriver($this); $dir = mockDir($this, $driver, $dirname); $this->assertEquals(['a', 'b'], $dir->children); }
public function testProperties() { $filename = 'test'; $driver = mockDriver($this); $file = mockFile($this, $driver, $filename); $this->assertEquals(100, $file->size); }
public function testWrite() { $driver = mockDriver($this); $file = mockFile($this, $driver, ''); $out = mockFileWriter($this, $file); $this->assertEquals(10, $out->write('1234567890')); }
function mockDirDriver(PHPUnit_Framework_TestCase $testcase, $filename) { $driver = mockDriver($testcase); $dir = mockDir($testcase, $driver, $filename); $driver->method('isFile')->willReturn(false); $driver->method('isDir')->willReturn(true); $driver->method('instantiateDir')->willReturn($dir); return $driver; }
public function testRead() { $driver = mockDriver($this); $file = mockFile($this, $driver, ''); $in = mockFileInputStream($this, $file, 100); $this->assertTrue($in->has_more); $this->assertEquals(50, strlen($in->read(50))); $this->assertTrue($in->has_more); $this->assertEquals(50, strlen($in->read(50))); $this->assertFalse($in->has_more); }
public function testProperties() { $driver = mockDriver($this); $filename = 'test/a'; $path = mockPath($this, $driver, $filename); $this->assertEquals($driver, $path->driver); $this->assertEquals($filename, $path->path); $this->assertEquals('a', $path->name); $this->assertTrue($path->exists); $this->assertTrue($path->is_link); $this->assertTrue($path->is_readable); $this->assertTrue($path->is_writable); }