ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ClientIdTest Class Reference
+ Inheritance diagram for ClientIdTest:
+ Collaboration diagram for ClientIdTest:

Public Member Functions

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

Static Public Member Functions

static clientIdProvider ()
 
static invalidClientIdProvider ()
 

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 29 of file ClientIdTest.php.

Member Function Documentation

◆ clientIdProvider()

static ClientIdTest::clientIdProvider ( )
static
Returns
array[]

Definition at line 45 of file ClientIdTest.php.

45  : array
46  {
47  return [
48  'single letter' => ['c'],
49  'multiple letters' => ['client'],
50  'single uppercase letter' => ['C'],
51  'multiple uppercase letters' => ['CLIENT'],
52  'single digit' => ['1'],
53  'multiple digits' => ['12'],
54  'letters + underscores' => ['client_with_underscore'],
55  'letters + underscores + digits' => ['client_with_12345'],
56  'letters + hyphens' => ['client-with-hyphen'],
57  'dots + sharps' => ['.#'] // looks weird, but is considered valid
58  ];
59  }

◆ invalidClientIdProvider()

static ClientIdTest::invalidClientIdProvider ( )
static
Returns
array[]

Definition at line 64 of file ClientIdTest.php.

64  : array
65  {
66  return [
67  'path traversal' => ['../../../../some/obscure/path'],
68  'space in between' => ['my client'],
69  'wrapped in spaces' => [' myclient '],
70  'umlaut' => ['clüent'],
71  ];
72  }

◆ setUp()

ClientIdTest::setUp ( )
protected

Definition at line 37 of file ClientIdTest.php.

37  : void
38  {
39  $this->f = new Data\Factory();
40  }

◆ testClientIdCannotBeCreatedByAnEmptyString()

ClientIdTest::testClientIdCannotBeCreatedByAnEmptyString ( )

Definition at line 98 of file ClientIdTest.php.

98  : void
99  {
100  $this->expectException(InvalidArgumentException::class);
101 
102  $this->f->clientId('');
103  }

◆ testInvalidArguments()

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

Definition at line 88 of file ClientIdTest.php.

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

88  : void
89  {
90  try {
91  $clientId = $this->f->clientId($value);
92  $this->fail('This should not happen');
93  } catch (InvalidArgumentException $e) {
94  $this->assertTrue(true);
95  }
96  }
$clientId
Definition: ltiregend.php:25

◆ testValidArguments()

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

Definition at line 78 of file ClientIdTest.php.

References $clientId.

78  : void
79  {
80  $clientId = $this->f->clientId($value);
81  $this->assertEquals($value, $clientId->toString());
82  }
$clientId
Definition: ltiregend.php:25

Field Documentation

◆ $f

Data Factory ClientIdTest::$f
private

Definition at line 32 of file ClientIdTest.php.


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