/**
  * Test set up
  */
 public function setUp()
 {
     parent::setUp();
     $app = new Application();
     $this->container = $app->getContainer();
     $this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->rootFolder = $this->getMockBuilder('OCP\\Files\\IRootFolder')->disableOriginalConstructor()->getMock();
     $this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
 }
 /**
  * @dataProvider providesPreviewValidatorData
  *
  * @param int $maxWidth
  * @param int $maxHeight
  * @param int $width
  * @param int $height
  * @param bool $square
  * @param int $expectedWidth
  * @param int $expectedHeight
  */
 public function testPreviewValidator($maxWidth, $maxHeight, $width, $height, $square, $expectedWidth, $expectedHeight)
 {
     self::invokePrivate($this->previewManager, 'userId', ['tester']);
     $app = new Application();
     $dataDir = $app->getContainer()->getServer()->getConfig()->getSystemValue('datadirectory');
     self::invokePrivate($this->previewManager, 'dataDir', [$dataDir]);
     $fileId = 12345;
     $file = $this->mockFile($fileId);
     self::invokePrivate($this->previewManager, 'file', [$file]);
     self::invokePrivate($this->previewManager, 'dims', [[$maxWidth, $maxHeight]]);
     $preview = $this->mockGetPreview($fileId, $width, $height);
     self::invokePrivate($this->previewManager, 'preview', [$preview]);
     $response = $this->previewManager->previewValidator($square);
     $this->assertEquals([$expectedWidth, $expectedHeight], [$response->width(), $response->height()]);
 }
 /**
  * Test set up
  */
 public function setUp()
 {
     parent::setUp();
     $app = new Application();
     $this->container = $app->getContainer();
     $this->container['UserFolder'] = $this->getMockBuilder('OCP\\Files\\Folder')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->searchFolderService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\SearchFolderService')->disableOriginalConstructor()->getMock();
     $this->configService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\ConfigService')->disableOriginalConstructor()->getMock();
     $this->searchMediaService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\SearchMediaService')->disableOriginalConstructor()->getMock();
     $this->downloadService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\DownloadService')->disableOriginalConstructor()->getMock();
     $this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
     $this->controller = new FilesController($this->appName, $this->request, $this->urlGenerator, $this->searchFolderService, $this->configService, $this->searchMediaService, $this->downloadService, $this->logger);
 }
 /**
  * Test set up
  */
 public function setUp()
 {
     parent::setUp();
     $app = new Application();
     $this->container = $app->getContainer();
     $this->container['UserFolder'] = $this->getMockBuilder('OCP\\Files\\Folder')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->configService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\ConfigService')->disableOriginalConstructor()->getMock();
     $this->thumbnailService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\ThumbnailService')->disableOriginalConstructor()->getMock();
     $this->previewService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\PreviewService')->disableOriginalConstructor()->getMock();
     $this->downloadService = $this->getMockBuilder('\\OCA\\Gallery\\Service\\DownloadService')->disableOriginalConstructor()->getMock();
     $this->eventSource = $this->getMockBuilder('\\OCA\\Gallery\\Utility\\EventSource')->disableOriginalConstructor()->getMock();
     $this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
     $this->controller = new PreviewController($this->appName, $this->request, $this->urlGenerator, $this->configService, $this->thumbnailService, $this->previewService, $this->downloadService, $this->eventSource, $this->logger);
 }
 /**
  * Runs before each test (public method)
  *
  * It's important to recreate the app for every test, as if the user had just logged in
  *
  * @fixme Or just create the app once for each type of env and run all tests. For that to work,
  *     I think I would need to switch to Cepts
  */
 protected function _before()
 {
     $this->coreTestCase->setUp();
     $app = new Gallery();
     $this->container = $app->getContainer();
     $this->server = $this->container->getServer();
     $setupData = $this->getModule('\\Helper\\DataSetup');
     $this->userId = $setupData->userId;
     $this->sharerUserId = $setupData->sharerUserId;
     $this->sharedFolder = $setupData->sharedFolder;
     $this->sharedFolderName = $this->sharedFolder->getName();
     $this->sharedFile = $setupData->sharedFile;
     $this->sharedFileName = $this->sharedFile->getName();
     $this->sharedFolderToken = $setupData->sharedFolderToken;
     $this->sharedFileToken = $setupData->sharedFileToken;
     $this->passwordForFolderShare = $setupData->passwordForFolderShare;
 }
Example #6
0
/**
 * ownCloud - gallery application
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Olivier Paroz <*****@*****.**>
 * @author Robin Appelman <*****@*****.**>
 *
 * @copyright Olivier Paroz 2014-2015
 * @copyright Robin Appelman 2014-2015
 */
namespace OCA\Gallery\AppInfo;

use OCP\Util;
$app = new Application();
$c = $app->getContainer();
$appName = $c->query('AppName');
/**
 * Menu entry in ownCloud
 */
$c->query('OCP\\INavigationManager')->add(function () use($c, $appName) {
    $urlGenerator = $c->query('OCP\\IURLGenerator');
    $l10n = $c->query('OCP\\IL10N');
    return ['id' => $appName, 'order' => 3, 'href' => $urlGenerator->linkToRoute($appName . '.page.index'), 'icon' => $urlGenerator->imagePath($appName, 'app.svg'), 'name' => $l10n->t('Gallery')];
});
/**
 * Loading translations
 *
 * The string has to match the app's folder name
 */