summaryrefslogtreecommitdiffstats
path: root/tests/lib/Security
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Security')
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php33
1 files changed, 23 insertions, 10 deletions
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index aedc4cb6a17..3fedf8964c5 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -33,15 +33,29 @@ class TrustedDomainHelperTest extends \Test\TestCase {
* @param string $testDomain
* @param bool $result
*/
+ public function testIsTrustedUrl($trustedDomains, $testDomain, $result) {
+ $this->config->method('getSystemValue')
+ ->willReturnMap([
+ ['overwritehost', '', ''],
+ ['trusted_domains', [], $trustedDomains],
+ ]);
+
+ $trustedDomainHelper = new TrustedDomainHelper($this->config);
+ $this->assertEquals($result, $trustedDomainHelper->isTrustedUrl('https://' . $testDomain . '/index.php/something'));
+ }
+
+ /**
+ * @dataProvider trustedDomainDataProvider
+ * @param string $trustedDomains
+ * @param string $testDomain
+ * @param bool $result
+ */
public function testIsTrustedDomain($trustedDomains, $testDomain, $result) {
- $this->config->expects($this->at(0))
- ->method('getSystemValue')
- ->with('overwritehost')
- ->willReturn('');
- $this->config->expects($this->at(1))
- ->method('getSystemValue')
- ->with('trusted_domains')
- ->willReturn($trustedDomains);
+ $this->config->method('getSystemValue')
+ ->willReturnMap([
+ ['overwritehost', '', ''],
+ ['trusted_domains', [], $trustedDomains],
+ ]);
$trustedDomainHelper = new TrustedDomainHelper($this->config);
$this->assertEquals($result, $trustedDomainHelper->isTrustedDomain($testDomain));
@@ -122,8 +136,7 @@ class TrustedDomainHelperTest extends \Test\TestCase {
}
public function testIsTrustedDomainOverwriteHost() {
- $this->config->expects($this->at(0))
- ->method('getSystemValue')
+ $this->config->method('getSystemValue')
->with('overwritehost')
->willReturn('myproxyhost');