diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-15 13:19:17 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-16 14:15:04 +0200 |
commit | b25c06f5769fbcd90a780cbce90998a38c112043 (patch) | |
tree | 3e132d33eacce05ec0ee021a0f1efa953538892a /tests/lib/encryption | |
parent | 67500d5f2fa9eae33a33095b3e0ddc723dae69c5 (diff) | |
download | nextcloud-server-b25c06f5769fbcd90a780cbce90998a38c112043.tar.gz nextcloud-server-b25c06f5769fbcd90a780cbce90998a38c112043.zip |
detect system wide mount points correctly
Diffstat (limited to 'tests/lib/encryption')
-rw-r--r-- | tests/lib/encryption/utiltest.php | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/lib/encryption/utiltest.php b/tests/lib/encryption/utiltest.php index 03aefe61151..dc6205e16fd 100644 --- a/tests/lib/encryption/utiltest.php +++ b/tests/lib/encryption/utiltest.php @@ -21,8 +21,14 @@ class UtilTest extends TestCase { protected $userManager; /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $groupManager; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ private $config; + /** @var \OC\Encryption\Util */ + private $util; + public function setUp() { parent::setUp(); $this->view = $this->getMockBuilder('OC\Files\View') @@ -33,18 +39,28 @@ class UtilTest extends TestCase { ->disableOriginalConstructor() ->getMock(); + $this->groupManager = $this->getMockBuilder('OC\Group\Manager') + ->disableOriginalConstructor() + ->getMock(); + $this->config = $this->getMockBuilder('OCP\IConfig') ->disableOriginalConstructor() ->getMock(); + $this->util = new Util( + $this->view, + $this->userManager, + $this->groupManager, + $this->config + ); + } /** * @dataProvider providesHeadersForEncryptionModule */ public function testGetEncryptionModuleId($expected, $header) { - $u = new Util($this->view, $this->userManager, $this->config); - $id = $u->getEncryptionModuleId($header); + $id = $this->util->getEncryptionModuleId($header); $this->assertEquals($expected, $id); } @@ -61,8 +77,7 @@ class UtilTest extends TestCase { */ public function testReadHeader($header, $expected, $moduleId) { $expected['oc_encryption_module'] = $moduleId; - $u = new Util($this->view, $this->userManager, $this->config); - $result = $u->readHeader($header); + $result = $this->util->readHeader($header); $this->assertSameSize($expected, $result); foreach ($expected as $key => $value) { $this->assertArrayHasKey($key, $result); @@ -78,8 +93,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, $this->config); - $result = $u->createHeader($header, $em); + $result = $this->util->createHeader($header, $em); $this->assertEquals($expected, $result); } @@ -102,23 +116,20 @@ 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, $this->config); - $u->createHeader($header, $em); + $this->util->createHeader($header, $em); } /** * @dataProvider providePathsForTestIsExcluded */ - public function testIsEcluded($path, $expected) { + public function testIsExcluded($path, $expected) { $this->userManager ->expects($this->any()) ->method('userExists') ->will($this->returnCallback(array($this, 'isExcludedCallback'))); - $u = new Util($this->view, $this->userManager, $this->config); - $this->assertSame($expected, - $u->isExcluded($path) + $this->util->isExcluded($path) ); } |