Skip to content

Commit

Permalink
Merge pull request #162 from owncloud/stable10-fix-158
Browse files Browse the repository at this point in the history
[Stable10] Fix background job
  • Loading branch information
Vincent Petry authored Jul 4, 2017
2 parents c22d7bc + c358fb9 commit 9edd57f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For this app to be effective, the ClamAV virus definitions should be kept up to
<repository type="git">http://github.com/owncloud/files_antivirus.git</repository>
<licence>AGPL</licence>
<author>Manuel Delgado, Bart Visscher, thinksilicon.de, Victor Dubiniuk</author>
<version>0.10.0.0</version>
<version>0.10.0.1</version>
<types>
<filesystem/>
</types>
Expand Down
4 changes: 2 additions & 2 deletions lib/backgroundscanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function getFilesForScan(){
);
} else {
$concatFunction = $qb->createFunction(
"'/' || " . $qb->getColumnName('mnt.user_id') . " || '/')"
"'/' || " . $qb->getColumnName('mnt.user_id') . " || '/'"
);
}

Expand All @@ -120,7 +120,7 @@ protected function getFilesForScan(){
);
}

$qb->select(['fc.fileid, mnt.user_id'])
$qb->select(['fc.fileid', 'mnt.user_id'])
->from('filecache', 'fc')
->leftJoin('fc', 'files_antivirus', 'fa', $qb->expr()->eq('fa.fileid', 'fc.fileid'))
->innerJoin(
Expand Down
43 changes: 43 additions & 0 deletions tests/BackgroundScannerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/**
* Copyright (c) 2017 Victor Dubiniuk <[email protected]>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/


namespace OCA\Files_antivirus\Tests;

use OCA\Files_Antivirus\BackgroundScanner;
use OCA\Files_Antivirus\ScannerFactory;
use Doctrine\DBAL\Driver\PDOStatement;

class BackgroundScannerTest extends TestBase {

public function testGetFilesForScan(){

$scannerFactory = new Mock\ScannerFactory(
new Mock\Config($this->container->query('CoreConfig')),
$this->container->query('Logger')
);

$scannerMock = $this->getMockBuilder(BackgroundScanner::class)
->setConstructorArgs([
$scannerFactory,
$this->l10n,
$this->config,
\OC::$server->getRootFolder(),
\OC::$server->getUserSession()
])
->getMock();

$class = new \ReflectionClass($scannerMock);
$method = $class->getMethod('getFilesForScan');
$method->setAccessible(true);
$result = $method->invokeArgs($scannerMock, []);
$this->assertEquals(PDOStatement::class, get_class($result));
}

}

0 comments on commit 9edd57f

Please sign in to comment.