ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 92 of file ClientIdTest.php.

92 : void
93 {
94 $this->expectException(InvalidArgumentException::class);
95
96 $this->f->clientId('');
97 }

◆ testInvalidArguments()

ClientIdTest::testInvalidArguments ( string  $value)

Definition at line 82 of file ClientIdTest.php.

82 : void
83 {
84 try {
85 $clientId = $this->f->clientId($value);
86 $this->fail('This should not happen');
87 } catch (InvalidArgumentException $e) {
88 $this->assertTrue(true);
89 }
90 }
$clientId
Definition: ltiregend.php:26

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

◆ testValidArguments()

ClientIdTest::testValidArguments ( string  $value)

Definition at line 75 of file ClientIdTest.php.

75 : void
76 {
77 $clientId = $this->f->clientId($value);
78 $this->assertEquals($value, $clientId->toString());
79 }

References $clientId.

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: