summaryrefslogtreecommitdiffstats
path: root/tests/lib/Security/RemoteHostValidatorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Security/RemoteHostValidatorTest.php')
-rw-r--r--tests/lib/Security/RemoteHostValidatorTest.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/lib/Security/RemoteHostValidatorTest.php b/tests/lib/Security/RemoteHostValidatorTest.php
index 030a75b1e79..b1371d9343c 100644
--- a/tests/lib/Security/RemoteHostValidatorTest.php
+++ b/tests/lib/Security/RemoteHostValidatorTest.php
@@ -60,8 +60,17 @@ class RemoteHostValidatorTest extends TestCase {
);
}
- public function testValid(): void {
- $host = 'nextcloud.com';
+ public function dataValid(): array {
+ return [
+ ['nextcloud.com', true],
+ ['com.one-.nextcloud-one.com', false],
+ ];
+ }
+
+ /**
+ * @dataProvider dataValid
+ */
+ public function testValid(string $host, bool $expected): void {
$this->hostnameClassifier
->method('isLocalHostname')
->with($host)
@@ -73,7 +82,7 @@ class RemoteHostValidatorTest extends TestCase {
$valid = $this->validator->isValid($host);
- self::assertTrue($valid);
+ self::assertSame($expected, $valid);
}
public function testLocalHostname(): void {