Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-12 18:08:54 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-08-01 10:46:40 +0300
commit458c2fa2971e6595a18a289b0afeb4a79ea0e0d3 (patch)
treec0bebce50e7d6956045df53f1e51dc44b0ab6c9e /tests
parent952acd4d276b3190d23e0597c5e01b1dfc4d72bc (diff)
Remove OCP\App and OCP\BackgroundJobcleanup/remove-long-deprecated-classes
Both deprecated since NC 23 IAppManager is the replacement for OCP\App unfortunately it can't be dependency injected in classes used by the installed otherwise the database connection is initialised too early Signed-off-by: Carl Schwan <carl@carlschwan.eu>
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));
+ }
}