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 mockFileDriver(PHPUnit_Framework_TestCase $testcase, $filename) { $driver = mockDriver($testcase); $file = mockFile($testcase, $driver, $filename); $driver->method('isFile')->willReturn(true); $driver->method('isDir')->willReturn(false); $driver->method('instantiateFile')->willReturn($file); 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 testModifiedFileDoesntExist() { $this->setExpectedException(PathNotFoundException::class); $file = mockFile($this, $this->driver, $this->filename . 'idontexist'); $this->assertInternalType('int', $this->driver->modified($file)); }