fixing unit test execution

This commit is contained in:
Thomas Müller 2015-04-02 18:12:20 +02:00
parent 111fbabfb4
commit 870c53ee37
1 changed files with 12 additions and 7 deletions

View File

@ -2,13 +2,13 @@
namespace Test\Files\Storage\Wrapper; namespace Test\Files\Storage\Wrapper;
use OC\Files\Storage\Temporary;
use OC\Files\View; use OC\Files\View;
use OCA\Encryption_Dummy\DummyModule;
class Encryption extends \Test\Files\Storage\Storage { class Encryption extends \Test\Files\Storage\Storage {
/** /**
* @var \OC\Files\Storage\Temporary * @var Temporary
*/ */
private $sourceStorage; private $sourceStorage;
@ -19,10 +19,7 @@ class Encryption extends \Test\Files\Storage\Storage {
$mockModule = $this->buildMockModule(); $mockModule = $this->buildMockModule();
$encryptionManager = $this->getMockBuilder('\OC\Encryption\Manager') $encryptionManager = $this->getMockBuilder('\OC\Encryption\Manager')
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['getDefaultEncryptionModule', 'getEncryptionModule']) ->setMethods(['getDefaultEncryptionModule', 'getEncryptionModule', 'isEnabled'])
->getMock();
$config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock(); ->getMock();
$encryptionManager->expects($this->any()) $encryptionManager->expects($this->any())
->method('getDefaultEncryptionModule') ->method('getDefaultEncryptionModule')
@ -30,6 +27,13 @@ class Encryption extends \Test\Files\Storage\Storage {
$encryptionManager->expects($this->any()) $encryptionManager->expects($this->any())
->method('getEncryptionModule') ->method('getEncryptionModule')
->willReturn($mockModule); ->willReturn($mockModule);
$encryptionManager->expects($this->any())
->method('isEnabled')
->willReturn(true);
$config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock();
$util = $this->getMock('\OC\Encryption\Util', ['getUidAndFilename'], [new View(), new \OC\User\Manager(), $config]); $util = $this->getMock('\OC\Encryption\Util', ['getUidAndFilename'], [new View(), new \OC\User\Manager(), $config]);
$util->expects($this->any()) $util->expects($this->any())
@ -37,13 +41,14 @@ class Encryption extends \Test\Files\Storage\Storage {
->willReturnCallback(function ($path) { ->willReturnCallback(function ($path) {
return ['user1', $path]; return ['user1', $path];
}); });
$file = $this->getMockBuilder('\OC\Encryption\File') $file = $this->getMockBuilder('\OC\Encryption\File')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$logger = $this->getMock('\OC\Log'); $logger = $this->getMock('\OC\Log');
$this->sourceStorage = new \OC\Files\Storage\Temporary(array()); $this->sourceStorage = new Temporary(array());
$keyStore = $this->getMockBuilder('\OC\Encryption\Keys\Storage') $keyStore = $this->getMockBuilder('\OC\Encryption\Keys\Storage')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->instance = new EncryptionWrapper([ $this->instance = new EncryptionWrapper([