Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More fixes
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Nov 27, 2019
commit ef4b59d3417ff9069425d7ae7a8e6e4f8165f7fb
8 changes: 8 additions & 0 deletions apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use OCA\DAV\CalDAV\CalendarHome;
use OCA\DAV\CalDAV\Search\SearchPlugin;
use OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport;
use Sabre\Xml\Service;
use Test\TestCase;

class SearchPluginTest extends TestCase {
Expand All @@ -41,6 +42,7 @@ public function setUp(): void {
$this->server = $this->createMock(\Sabre\DAV\Server::class);
$this->server->tree = $this->createMock(\Sabre\DAV\Tree::class);
$this->server->httpResponse = $this->createMock(\Sabre\HTTP\Response::class);
$this->server->xml = new Service();

$this->plugin = new SearchPlugin();
$this->plugin->initialize($this->server);
Expand All @@ -62,6 +64,7 @@ public function testInitialize() {
$server->expects($this->at(0))
->method('on')
->with('report', [$plugin, 'report']);
$server->xml = new Service();

$plugin->initialize($server);

Expand Down Expand Up @@ -93,6 +96,11 @@ public function testReport() {
->method('getHTTPDepth')
->with(2)
->will($this->returnValue(2));
$this->server
->method('getHTTPPrefer')
->willReturn([
'return' => null
]);
$calendarHome->expects($this->at(0))
->method('calendarSearch')
->will($this->returnValue([]));
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Controller/AvatarControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function testPostAvatarFileGif() {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.gif'));

//Create request return
$reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => filesize(\OC::$SERVERROOT.'/tests/data/testimage.gif')];
$reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [filesize(\OC::$SERVERROOT.'/tests/data/testimage.gif')]];
$this->request->method('getUploadedFile')->willReturn($reqRet);

$response = $this->avatarController->postAvatar(null);
Expand Down
21 changes: 15 additions & 6 deletions tests/lib/Files/Storage/Wrapper/EncryptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,17 @@ function($path) use ($encrypted) {
->method('getCache')
->with($path)
->willReturn($fileEntry);
$fileEntry->expects($this->any())
->method('get')
->with($metaData['fileid']);
if ($metaData !== null) {
$fileEntry->expects($this->any())
->method('get')
->with($metaData['fileid']);
}

$this->instance->expects($this->any())->method('getCache')->willReturn($cache);
$this->instance->expects($this->any())->method('verifyUnencryptedSize')
->with($path, 0)->willReturn($expected['size']);
if ($expected !== null) {
$this->instance->expects($this->any())->method('verifyUnencryptedSize')
->with($path, 0)->willReturn($expected['size']);
}

$result = $this->instance->getMetaData($path);
if(isset($expected['encrypted'])) {
Expand All @@ -300,7 +304,12 @@ function($path) use ($encrypted) {
$this->assertSame($expected['encryptedVersion'], $result['encryptedVersion']);
}
}
$this->assertSame($expected['size'], $result['size']);

if ($expected !== null) {
$this->assertSame($expected['size'], $result['size']);
} else {
$this->assertSame(null, $result);
}
}

public function dataTestGetMetaData() {
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/Session/CryptoWrappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ protected function setUp(): void {
$this->crypto->expects($this->any())
->method('decrypt')
->willReturnCallback(function ($input) {
if ($input === '') {
return '';
}
return substr($input, 1, -1);
});

Expand Down