ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ClientIdTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'libs/composer/vendor/autoload.php';
5 
6 use ILIAS\Data;
7 
12 {
14  private $f;
15 
19  protected function setUp()
20  {
21  $this->f = new Data\Factory();
22  }
23 
27  public function clientIdProvider() : array
28  {
29  return [
30  ['default'],
31  ['default_with_underscore'],
32  ['ilias_with_12345'],
33  ];
34  }
35 
39  public function invalidClientIdProvider() : array
40  {
41  return [
42  ['../../some/obscure/path'],
43  ];
44  }
45 
50  public function testValidArguments(string $value)
51  {
52  $clientId = $this->f->clientId($value);
53  $this->assertEquals($value, $clientId->toString());
54  }
55 
60  public function tesInvalidArguments(string $value)
61  {
62  try {
63  $clientId = $this->f->clientId($value);
64  $this->fail('This should not happen');
65  } catch (\InvalidArgumentException $e) {
66  $this->assertTrue(true);
67  }
68  }
69 }
testValidArguments(string $value)
invalidClientIdProvider()
tesInvalidArguments(string $value)
if(array_key_exists('provider', $_GET)) elseif(array_key_exists('provider', $_SESSION)) if(!in_array($providerName, ['Google', 'Microsoft', 'Yahoo'])) $clientId