diff options
Diffstat (limited to 'tests/lib/Encryption/UpdateTest.php')
-rw-r--r-- | tests/lib/Encryption/UpdateTest.php | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index 28d7ca81163..d7aa24d1f67 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -21,7 +21,6 @@ namespace Test\Encryption; - use OC\Encryption\Update; use OC\Files\Mount\Manager; use OC\Files\View; @@ -89,7 +88,6 @@ class UpdateTest extends TestCase { * @param integer $numberOfFiles */ public function testUpdate($path, $isDir, $allFiles, $numberOfFiles) { - $this->encryptionManager->expects($this->once()) ->method('getEncryptionModule') ->willReturn($this->encryptionModule); @@ -98,7 +96,7 @@ class UpdateTest extends TestCase { ->method('is_dir') ->willReturn($isDir); - if($isDir) { + if ($isDir) { $this->util->expects($this->once()) ->method('getAllFiles') ->willReturn($allFiles); @@ -121,10 +119,10 @@ class UpdateTest extends TestCase { * @return array */ public function dataTestUpdate() { - return array( - array('/user/files/foo', true, ['/user/files/foo/file1.txt', '/user/files/foo/file1.txt'], 2), - array('/user/files/test.txt', false, [], 1), - ); + return [ + ['/user/files/foo', true, ['/user/files/foo/file1.txt', '/user/files/foo/file1.txt'], 2], + ['/user/files/test.txt', false, [], 1], + ]; } /** @@ -135,7 +133,6 @@ class UpdateTest extends TestCase { * @param boolean $encryptionEnabled */ public function testPostRename($source, $target, $encryptionEnabled) { - $updateMock = $this->getUpdateMock(['update', 'getOwnerPath']); $this->encryptionManager->expects($this->once()) @@ -148,13 +145,12 @@ class UpdateTest extends TestCase { } else { $updateMock->expects($this->once()) ->method('getOwnerPath') - ->willReturnCallback(function($path) use ($target) { + ->willReturnCallback(function ($path) use ($target) { $this->assertSame( $target, $path, 'update needs to be executed for the target destination'); return ['owner', $path]; - }); $updateMock->expects($this->once())->method('update'); } @@ -168,14 +164,14 @@ class UpdateTest extends TestCase { * @return array */ public function dataTestPostRename() { - return array( - array('/test.txt', '/testNew.txt', true), - array('/test.txt', '/testNew.txt', false), - array('/folder/test.txt', '/testNew.txt', true), - array('/folder/test.txt', '/testNew.txt', false), - array('/folder/test.txt', '/testNew.txt', true), - array('/test.txt', '/folder/testNew.txt', false), - ); + return [ + ['/test.txt', '/testNew.txt', true], + ['/test.txt', '/testNew.txt', false], + ['/folder/test.txt', '/testNew.txt', true], + ['/folder/test.txt', '/testNew.txt', false], + ['/folder/test.txt', '/testNew.txt', true], + ['/test.txt', '/folder/testNew.txt', false], + ]; } @@ -185,7 +181,6 @@ class UpdateTest extends TestCase { * @param boolean $encryptionEnabled */ public function testPostRestore($encryptionEnabled) { - $updateMock = $this->getUpdateMock(['update']); $this->encryptionManager->expects($this->once()) @@ -194,7 +189,6 @@ class UpdateTest extends TestCase { if ($encryptionEnabled) { $updateMock->expects($this->once())->method('update'); - } else { $updateMock->expects($this->never())->method('update'); } @@ -208,10 +202,10 @@ class UpdateTest extends TestCase { * @return array */ public function dataTestPostRestore() { - return array( - array(true), - array(false), - ); + return [ + [true], + [false], + ]; } /** @@ -233,5 +227,4 @@ class UpdateTest extends TestCase { ] )->setMethods($methods)->getMock(); } - } |