diff options
author | Olivier Paroz <github@oparoz.com> | 2015-08-23 17:44:07 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-08-23 17:44:07 +0300 |
commit | 49cd5c9241d17b90a712f79b4b979408cba4d0fb (patch) | |
tree | 87b2ccf578bc2438f113d8857f0fd98846210182 /tests | |
parent | 0a567eefd204c771a7b5309b6cdec744da19c6bb (diff) |
Test PathManipulation trait
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/controller/FilesControllerTest.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/controller/FilesControllerTest.php b/tests/unit/controller/FilesControllerTest.php index d50fcd67..f24886ec 100644 --- a/tests/unit/controller/FilesControllerTest.php +++ b/tests/unit/controller/FilesControllerTest.php @@ -36,6 +36,8 @@ use OCA\Gallery\Service\DownloadService; */ class FilesControllerTest extends \Test\TestCase { + use PathManipulation; + /** @var IAppContainer */ protected $container; /** @var string */ @@ -195,6 +197,42 @@ class FilesControllerTest extends \Test\TestCase { $this->assertEquals($errorMessage, $response->getData()); } + public function providesFilesData() { + $location = 'folder1'; + $folderPathFromRoot = 'user/files/' . $location; + + return [ + [ + ['path' => $folderPathFromRoot . '/deep/folder/to/test/path/reduction.png'], + $folderPathFromRoot . '/deep/reduction.png', + $folderPathFromRoot + ], + [ + ['path' => $folderPathFromRoot . '/folder/image.png'], + $folderPathFromRoot . '/folder/image.png', + $folderPathFromRoot + ], + [ + ['path' => $folderPathFromRoot . '/testimage.png'], + $folderPathFromRoot . '/testimage.png', + $folderPathFromRoot + ] + ]; + } + + /** + * @dataProvider providesFilesData + * + * @param array $file + * @param string $fixedPath + * @param string $folderPathFromRoot + */ + public function testGetReducedPath($file, $fixedPath, $folderPathFromRoot) { + $response = $this->getReducedPath($file['path'], $folderPathFromRoot); + + $this->assertEquals($fixedPath, $response); + } + /** * Mocks Files->getDownload * |