diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-08-08 17:05:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-08 17:05:11 +0200 |
commit | f8b13ecd604451eb853bf1d7d1f12aadc857e527 (patch) | |
tree | 2ec4ae37cc98bbef9b1c6e52fe05dd0aab0706c9 /tests | |
parent | fe2f8b5d189cbcda8c4f197197169a6e015d6622 (diff) | |
parent | 458c2fa2971e6595a18a289b0afeb4a79ea0e0d3 (diff) | |
download | nextcloud-server-f8b13ecd604451eb853bf1d7d1f12aadc857e527.tar.gz nextcloud-server-f8b13ecd604451eb853bf1d7d1f12aadc857e527.zip |
Merge pull request #32363 from nextcloud/cleanup/remove-long-deprecated-classes
Remove OCP\App and OCP\BackgroundJob
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Encryption/UtilTest.php | 29 | ||||
-rw-r--r-- | tests/lib/UrlGeneratorTest.php | 16 |
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)); + } } |