summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Encryption/UtilTest.php29
-rw-r--r--tests/lib/UrlGeneratorTest.php16
2 files changed, 25 insertions, 20 deletions
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index 02155be11dd..248377fc698 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -8,6 +8,8 @@ use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\Encryption\IEncryptionModule;
use OCP\IConfig;
+use OCP\IGroupManager;
+use OCP\IUserManager;
use Test\TestCase;
class UtilTest extends TestCase {
@@ -15,24 +17,21 @@ class UtilTest extends TestCase {
/**
* block size will always be 8192 for a PHP stream
* @see https://bugs.php.net/bug.php?id=21641
- * @var integer
*/
- protected $headerSize = 8192;
+ protected int $headerSize = 8192;
/** @var \PHPUnit\Framework\MockObject\MockObject */
protected $view;
- /** @var \PHPUnit\Framework\MockObject\MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IUserManager */
protected $userManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IGroupManager */
protected $groupManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */
private $config;
-
- /** @var \OC\Encryption\Util */
- private $util;
+ private Util $util;
protected function setUp(): void {
parent::setUp();
@@ -40,17 +39,9 @@ class UtilTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $this->userManager = $this->getMockBuilder('OC\User\Manager')
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->groupManager = $this->getMockBuilder('OC\Group\Manager')
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->config = $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()
- ->getMock();
+ $this->userManager = $this->createMock(IUserManager::class);
+ $this->groupManager = $this->createMock(IGroupManager::class);
+ $this->config = $this->createMock(IConfig::class);
$this->util = new Util(
$this->view,
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 9e5795fc41e..7fdbb7fb37e 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -297,7 +297,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->assertEquals('http://localhost' . \OC::$WEBROOT . $expectedPath, $this->urlGenerator->linkToDefaultPageUrl());
}
- public function provideDefaultApps() {
+ public function provideDefaultApps(): array {
return [
// none specified, default to files
[
@@ -321,4 +321,18 @@ class UrlGeneratorTest extends \Test\TestCase {
],
];
}
+
+ public function imagePathProvider(): array {
+ return [
+ ['core', 'favicon-mask.svg', \OC::$WEBROOT . '/core/img/favicon-mask.svg'],
+ ['files', 'external.svg', \OC::$WEBROOT . '/apps/files/img/external.svg'],
+ ];
+ }
+
+ /**
+ * @dataProvider imagePathProvider
+ */
+ public function testImagePath(string $appName, string $file, string $result): void {
+ $this->assertSame($result, $this->urlGenerator->imagePath($appName, $file));
+ }
}