summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Http/Client/ClientTest.php1
-rw-r--r--tests/lib/Security/RemoteHostValidatorTest.php15
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php
index e48e237e0cc..4d937b6c0f2 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -148,6 +148,7 @@ class ClientTest extends \Test\TestCase {
['https://service.localhost'],
['!@#$', true], // test invalid url
['https://normal.host.com'],
+ ['https://com.one-.nextcloud-one.com'],
];
}
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 {