aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2025-02-18 12:30:33 +0100
committerprovokateurin <kate@provokateurin.de>2025-03-04 07:49:20 +0100
commit552eb2678f622458e16ff21a1320ee6ba78aaa7c (patch)
treed6be5c88ba4cd46d4b9ba641844f4aebee9da44a /tests
parent745b72b0c56960bbe4b1a0517d430e1e49d4b87b (diff)
downloadnextcloud-server-552eb2678f622458e16ff21a1320ee6ba78aaa7c.tar.gz
nextcloud-server-552eb2678f622458e16ff21a1320ee6ba78aaa7c.zip
refactor(TempManager): Simplify and unify implementations and remove legacy behaviorbackport/51194/stable30
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/TempManagerTest.php25
1 files changed, 7 insertions, 18 deletions
diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php
index 89b66654570..5a7cb6757a1 100644
--- a/tests/lib/TempManagerTest.php
+++ b/tests/lib/TempManagerTest.php
@@ -154,34 +154,23 @@ class TempManagerTest extends \Test\TestCase {
$this->assertFalse($manager->getTemporaryFolder());
}
- public function testBuildFileNameWithPostfix() {
+ public function testGenerateTemporaryPathWithPostfix(): void {
$logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
- 'buildFileNameWithSuffix',
- ['/tmp/myTemporaryFile', 'postfix']
+ 'generateTemporaryPath',
+ ['postfix']
);
- $this->assertEquals('/tmp/myTemporaryFile-.postfix', $tmpManager);
+ $this->assertStringEndsWith('.postfix', $tmpManager);
}
- public function testBuildFileNameWithoutPostfix() {
+ public function testGenerateTemporaryPathTraversal(): void {
$logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
- 'buildFileNameWithSuffix',
- ['/tmp/myTemporaryFile', '']
- );
-
- $this->assertEquals('/tmp/myTemporaryFile', $tmpManager);
- }
-
- public function testBuildFileNameWithSuffixPathTraversal() {
- $logger = $this->createMock(LoggerInterface::class);
- $tmpManager = self::invokePrivate(
- $this->getManager($logger),
- 'buildFileNameWithSuffix',
- ['foo', '../Traversal\\../FileName']
+ 'generateTemporaryPath',
+ ['../Traversal\\../FileName']
);
$this->assertStringEndsNotWith('./Traversal\\../FileName', $tmpManager);