-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d137941
commit 3bc02fc
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
define('PHPUNIT_RUN', 1); | ||
|
||
require_once __DIR__.'/../../../../lib/base.php'; | ||
|
||
if(!class_exists('PHPUnit_Framework_TestCase')) { | ||
require_once('PHPUnit/Autoload.php'); | ||
} | ||
|
||
OC_Hook::clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<phpunit bootstrap="bootstrap.php" | ||
verbose="true" | ||
timeoutForSmallTests="900" | ||
timeoutForMediumTests="900" | ||
timeoutForLargeTests="900" | ||
> | ||
<testsuite name='unit'> | ||
<directory suffix='test.php'>.</directory> | ||
</testsuite> | ||
<!-- filters for code coverage --> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">../../dav</directory> | ||
<exclude> | ||
<directory suffix=".php">../../dav/tests</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<!-- and this is where your report will be written --> | ||
<log type="coverage-clover" target="./clover.xml"/> | ||
</logging> | ||
</phpunit> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
class FutureFileTest extends \PHPUnit_Framework_TestCase { | ||
|
||
public function testGetContentType() { | ||
$f = $this->mockFutureFile(); | ||
$this->assertEquals('application/octet-stream', $f->getContentType()); | ||
} | ||
|
||
public function testGetETag() { | ||
$f = $this->mockFutureFile(); | ||
$this->assertEquals('1234567890', $f->getETag()); | ||
} | ||
|
||
public function testGetName() { | ||
$f = $this->mockFutureFile(); | ||
$this->assertEquals('foo.txt', $f->getName()); | ||
} | ||
|
||
/** | ||
* @return \OCA\DAV\Upload\FutureFile | ||
*/ | ||
private function mockFutureFile() { | ||
$d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory') | ||
->disableOriginalConstructor() | ||
->setMethods(['getETag']) | ||
->getMock(); | ||
|
||
$d->expects($this->any()) | ||
->method('getETag') | ||
->willReturn('1234567890'); | ||
|
||
return new \OCA\DAV\Upload\FutureFile($d, 'foo.txt'); | ||
} | ||
} | ||
|