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

github.com/nextcloud/files_antivirus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2021-08-13 18:53:10 +0300
committerRichard Steinmetz <richard@steinmetz.cloud>2021-08-20 17:13:29 +0300
commit2d12723f1111fac54abf1b7ca643555d0c09297a (patch)
treeb2f4e9b675a93b55303e545e0f900c9e4083201e /tests
parente888f598f93f9864c509f19e6f1a32d79186b033 (diff)
Use strict comparison
Prevent AvirWrapper from wrapping streams that shouldn't be wrapped. Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'tests')
-rw-r--r--tests/AvirWrapperTest.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/AvirWrapperTest.php b/tests/AvirWrapperTest.php
index f00e0cd..84349a0 100644
--- a/tests/AvirWrapperTest.php
+++ b/tests/AvirWrapperTest.php
@@ -104,4 +104,22 @@ class AvirWrapperTest extends TestBase {
fwrite($fd, str_repeat('0', DummyClam::TEST_STREAM_SIZE - 2) . DummyClam::TEST_SIGNATURE);
fwrite($fd, DummyClam::TEST_SIGNATURE);
}
+
+ /**
+ * @dataProvider shouldWrapProvider
+ */
+ public function testShouldWrap(string $path, bool $expected) {
+ $actual = self::invokePrivate($this->wrappedStorage, 'shouldWrap', [$path]);
+ self::assertEquals($expected, $actual);
+ }
+
+ public function shouldWrapProvider(): array {
+ return [
+ ['/files/my_file_1', true],
+ ['files/my_file_2', true],
+ ['/files_external/rootcerts.crt', false],
+ ['/files_external/rootcerts.crt.tmp.0123456789', false],
+ ['/root_file', false],
+ ];
+ }
}