ILIAS  release_8 Revision v8.19
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

Data Factory $f
 

Detailed Description

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

Definition at line 15 of file ClientIdTest.php.

Member Function Documentation

◆ clientIdProvider()

ClientIdTest::clientIdProvider ( )
Returns
array[]

Definition at line 31 of file ClientIdTest.php.

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

◆ invalidClientIdProvider()

ClientIdTest::invalidClientIdProvider ( )
Returns
array[]

Definition at line 50 of file ClientIdTest.php.

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

◆ setUp()

ClientIdTest::setUp ( )
protected

Definition at line 23 of file ClientIdTest.php.

23  : void
24  {
25  $this->f = new Data\Factory();
26  }

◆ testClientIdCannotBeCreatedByAnEmptyString()

ClientIdTest::testClientIdCannotBeCreatedByAnEmptyString ( )

Definition at line 84 of file ClientIdTest.php.

84  : void
85  {
86  $this->expectException(InvalidArgumentException::class);
87 
88  $this->f->clientId('');
89  }

◆ testInvalidArguments()

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

Definition at line 74 of file ClientIdTest.php.

References $clientId, and Vendor\Package\$e.

74  : void
75  {
76  try {
77  $clientId = $this->f->clientId($value);
78  $this->fail('This should not happen');
79  } catch (InvalidArgumentException $e) {
80  $this->assertTrue(true);
81  }
82  }
$clientId
Definition: ltiregend.php:27

◆ testValidArguments()

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

Definition at line 64 of file ClientIdTest.php.

References $clientId.

64  : void
65  {
66  $clientId = $this->f->clientId($value);
67  $this->assertEquals($value, $clientId->toString());
68  }
$clientId
Definition: ltiregend.php:27

Field Documentation

◆ $f

Data Factory ClientIdTest::$f
private

Definition at line 18 of file ClientIdTest.php.


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