diff options
author | Stephan Orbaugh <62374139+sorbaugh@users.noreply.github.com> | 2024-07-22 10:40:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-22 10:40:50 +0200 |
commit | 9ed2d3e4958ffb5fdd80d67c489a7a19b106ac0a (patch) | |
tree | aebb7e82c352069803e5798c44b18917b0455f10 /tests | |
parent | c2a571e435bebb08a4b6429eea343c350d3ccaf6 (diff) | |
parent | 9716b0d7350aa28481a5a9642b74da847c0fa211 (diff) | |
download | nextcloud-server-9ed2d3e4958ffb5fdd80d67c489a7a19b106ac0a.tar.gz nextcloud-server-9ed2d3e4958ffb5fdd80d67c489a7a19b106ac0a.zip |
Merge pull request #46571 from nextcloud/chore/migrate-to-filenamevalidator
refactor: Migrate some legacy and core functions to `IFilenameValidator`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Security/CertificateManagerTest.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index fc5ae1f03f2..e123ebeda25 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -12,8 +12,10 @@ namespace Test\Security; use OC\Files\View; use OC\Security\CertificateManager; +use OCP\Files\InvalidPathException; use OCP\IConfig; use OCP\Security\ISecureRandom; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; /** @@ -25,12 +27,9 @@ class CertificateManagerTest extends \Test\TestCase { use \Test\Traits\UserTrait; use \Test\Traits\MountProviderTrait; - /** @var CertificateManager */ - private $certificateManager; - /** @var String */ - private $username; - /** @var ISecureRandom */ - private $random; + private CertificateManager $certificateManager; + private string $username; + private ISecureRandom&MockObject $random; protected function setUp(): void { parent::setUp(); @@ -117,9 +116,7 @@ class CertificateManagerTest extends \Test\TestCase { * @param string $filename */ public function testAddDangerousFile($filename) { - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Filename is not valid'); - + $this->expectException(InvalidPathException::class); $this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), $filename); } |