From 4aa125cc0a2b5a129c4f97d807f7a225a7620199 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20M=C3=BCller?= Date: Mon, 30 Mar 2015 11:01:06 +0200 Subject: [PATCH] fix unit test execution --- tests/lib/encryption/utiltest.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/lib/encryption/utiltest.php b/tests/lib/encryption/utiltest.php index 672f9ff5e97..03aefe61151 100644 --- a/tests/lib/encryption/utiltest.php +++ b/tests/lib/encryption/utiltest.php @@ -20,6 +20,9 @@ class UtilTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $userManager; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + private $config; + public function setUp() { parent::setUp(); $this->view = $this->getMockBuilder('OC\Files\View') @@ -29,13 +32,18 @@ class UtilTest extends TestCase { $this->userManager = $this->getMockBuilder('OC\User\Manager') ->disableOriginalConstructor() ->getMock(); + + $this->config = $this->getMockBuilder('OCP\IConfig') + ->disableOriginalConstructor() + ->getMock(); + } /** * @dataProvider providesHeadersForEncryptionModule */ public function testGetEncryptionModuleId($expected, $header) { - $u = new Util($this->view, $this->userManager); + $u = new Util($this->view, $this->userManager, $this->config); $id = $u->getEncryptionModuleId($header); $this->assertEquals($expected, $id); } @@ -53,7 +61,7 @@ class UtilTest extends TestCase { */ public function testReadHeader($header, $expected, $moduleId) { $expected['oc_encryption_module'] = $moduleId; - $u = new Util($this->view, $this->userManager); + $u = new Util($this->view, $this->userManager, $this->config); $result = $u->readHeader($header); $this->assertSameSize($expected, $result); foreach ($expected as $key => $value) { @@ -70,7 +78,7 @@ class UtilTest extends TestCase { $em = $this->getMock('\OCP\Encryption\IEncryptionModule'); $em->expects($this->any())->method('getId')->willReturn($moduleId); - $u = new Util($this->view, $this->userManager); + $u = new Util($this->view, $this->userManager, $this->config); $result = $u->createHeader($header, $em); $this->assertEquals($expected, $result); } @@ -94,7 +102,7 @@ class UtilTest extends TestCase { $em = $this->getMock('\OCP\Encryption\IEncryptionModule'); $em->expects($this->any())->method('getId')->willReturn('moduleId'); - $u = new Util($this->view, $this->userManager); + $u = new Util($this->view, $this->userManager, $this->config); $u->createHeader($header, $em); } @@ -107,7 +115,7 @@ class UtilTest extends TestCase { ->method('userExists') ->will($this->returnCallback(array($this, 'isExcludedCallback'))); - $u = new Util($this->view, $this->userManager); + $u = new Util($this->view, $this->userManager, $this->config); $this->assertSame($expected, $u->isExcluded($path) -- 2.39.5