Add fopen method to ISimpleFile
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
af20f1dd4b
commit
f1469e34aa
|
@ -146,4 +146,15 @@ class SimpleFile implements ISimpleFile {
|
||||||
public function getMimeType() {
|
public function getMimeType() {
|
||||||
return $this->file->getMimeType();
|
return $this->file->getMimeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
|
||||||
|
*
|
||||||
|
* @return resource
|
||||||
|
* @throws \OCP\Files\NotPermittedException
|
||||||
|
* @since 14.0.0
|
||||||
|
*/
|
||||||
|
public function fopen(string $mode) {
|
||||||
|
return $this->file->fopen($mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,4 +99,13 @@ interface ISimpleFile {
|
||||||
* @since 11.0.0
|
* @since 11.0.0
|
||||||
*/
|
*/
|
||||||
public function getMimeType();
|
public function getMimeType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
|
||||||
|
*
|
||||||
|
* @return resource
|
||||||
|
* @throws \OCP\Files\NotPermittedException
|
||||||
|
* @since 14.0.0
|
||||||
|
*/
|
||||||
|
public function fopen(string $mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,4 +123,12 @@ class SimpleFileTest extends \Test\TestCase {
|
||||||
|
|
||||||
$this->simpleFile->getContent();
|
$this->simpleFile->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFopen() {
|
||||||
|
$this->file->expects($this->once())
|
||||||
|
->method('fopen')
|
||||||
|
->with('r+');
|
||||||
|
|
||||||
|
$this->simpleFile->fopen('r+');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue