ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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()
28  {
29  return [
30  ['default'],
31  ['default_with_underscore'],
32  ['ilias_with_12345'],
33  ];
34  }
35 
39  public function invalidClientIdProvider()
40  {
41  return [
42  ['../../some/obscure/path'],
43  ];
44  }
45 
50  public function testValidArguments($value)
51  {
52  $clientId = $this->f->clientId($value);
53  $this->assertEquals($value, $clientId->toString());
54  }
55 
60  public function tesInvalidArguments($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 }
invalidClientIdProvider()
testValidArguments($value)
tesInvalidArguments($value)