ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ClientIdTest Class Reference
+ Inheritance diagram for ClientIdTest:
+ Collaboration diagram for ClientIdTest:

Public Member Functions

 clientIdProvider ()
 
 invalidClientIdProvider ()
 
 testValidArguments (string $value)
 
 testInvalidArguments (string $value)
 
 testClientIdCannotBeCreatedByAnEmptyString ()
 

Protected Member Functions

 setUp ()
 

Private Attributes

 $f
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 12 of file ClientIdTest.php.

Member Function Documentation

◆ clientIdProvider()

ClientIdTest::clientIdProvider ( )
Returns
array[]

Definition at line 28 of file ClientIdTest.php.

28  : array
29  {
30  return [
31  'single letter' => ['c'],
32  'multiple letters' => ['client'],
33  'single uppercase letter' => ['C'],
34  'multiple uppercase letters' => ['CLIENT'],
35  'single digit' => ['1'],
36  'multiple digits' => ['12'],
37  'letters + underscores' => ['client_with_underscore'],
38  'letters + underscores + digits' => ['client_with_12345'],
39  'letters + hyphens' => ['client-with-hyphen'],
40  'dots + sharps' => ['.#'] // looks weird, but is considered valid
41  ];
42  }

◆ invalidClientIdProvider()

ClientIdTest::invalidClientIdProvider ( )
Returns
array[]

Definition at line 47 of file ClientIdTest.php.

47  : array
48  {
49  return [
50  'path traversal' => ['../../some/obscure/path'],
51  'space in between' => ['my client'],
52  'wrapped in spaces' => [' myclient '],
53  'umlaut' => ['clüent'],
54  ];
55  }

◆ setUp()

ClientIdTest::setUp ( )
protected

Definition at line 20 of file ClientIdTest.php.

20  : void
21  {
22  $this->f = new Data\Factory();
23  }

◆ testClientIdCannotBeCreatedByAnEmptyString()

ClientIdTest::testClientIdCannotBeCreatedByAnEmptyString ( )

Definition at line 81 of file ClientIdTest.php.

81  : void
82  {
83  $this->expectException(InvalidArgumentException::class);
84 
85  $this->f->clientId('');
86  }

◆ testInvalidArguments()

ClientIdTest::testInvalidArguments ( string  $value)
Parameters
string$valueinvalidClientIdProvider

Definition at line 71 of file ClientIdTest.php.

References Vendor\Package\$e.

72  {
73  try {
74  $clientId = $this->f->clientId($value);
75  $this->fail('This should not happen');
76  } catch (\InvalidArgumentException $e) {
77  $this->assertTrue(true);
78  }
79  }

◆ testValidArguments()

ClientIdTest::testValidArguments ( string  $value)
Parameters
string$valueclientIdProvider

Definition at line 61 of file ClientIdTest.php.

62  {
63  $clientId = $this->f->clientId($value);
64  $this->assertEquals($value, $clientId->toString());
65  }

Field Documentation

◆ $f

ClientIdTest::$f
private

Definition at line 15 of file ClientIdTest.php.


The documentation for this class was generated from the following file: