ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilWhiteListUrlValidatorTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3 declare(strict_types=1);
4 
10 {
14  public function domainProvider() : array
15  {
16  return [
17  ['', [], false],
18  ['ilias.de', [], false],
19  ['https://ilias.de', [], false],
20  ['ilias.de', ['ilias.de'], false],
21  ['https://ilias.de', ['ilias.de'], true],
22  ['https://www.ilias.de', ['ilias.de'], true],
23  ['https://server01.www.ilias.de', ['ilias.de'], true],
24  ['https://server01.www.ilias.de', ['.ilias.de'], true],
25  ['https://server01.www.ilias.de', ['www.ilias.de'], true],
26  ['https://server01.www.ilias.de', ['.www.ilias.de'], true],
27  ['https://server01.www.ilias.de', ['server01.www.ilias.de'], true],
28  ['https://server01.www.ilias.de', ['.server01.www.ilias.de'], false],
29  ];
30  }
31 
38  public function testValidator(string $domain, array $whitelist, bool $result)
39  {
40  require_once 'Services/AuthApache/classes/class.ilWhiteListUrlValidator.php';
41  $this->assertEquals((new ilWhiteListUrlValidator($domain, $whitelist))->isValid(), $result);
42  }
43 }
$result
Class ilWhiteListUrlValidatorTest.
testValidator(string $domain, array $whitelist, bool $result)
domainProvider
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
Class ilWhiteListUrlValidator.