Skip to content

Commit

Permalink
App tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Jul 4, 2017
1 parent 556d2c8 commit 5e41899
Showing 1 changed file with 43 additions and 0 deletions.
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 5e41899

Please sign in to comment.