ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSamlMappedUserAttributeValueParserTest Class Reference
+ Inheritance diagram for ilSamlMappedUserAttributeValueParserTest:
+ Collaboration diagram for ilSamlMappedUserAttributeValueParserTest:

Public Member Functions

 testValueGivenAsStringCanBeRetrievedForExternalAttribute ()
 
 testValueGivenAsArrayCanBeRetrievedForExternalAttribute ()
 
 testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex ()
 
 testExceptionIsRaisedIfAnExpectedAttributeIsMissing ()
 
 testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex ()
 
 testExceptionIsRaisedForNonScalarValues ()
 

Protected Member Functions

 getMappingRuleMock (string $externalAttributeReference)
 

Detailed Description

Definition at line 23 of file ilSamlMappedUserAttributeValueParserTest.php.

Member Function Documentation

◆ getMappingRuleMock()

ilSamlMappedUserAttributeValueParserTest::getMappingRuleMock ( string  $externalAttributeReference)
protected

Definition at line 25 of file ilSamlMappedUserAttributeValueParserTest.php.

26 {
27 $rule = $this->getMockBuilder(ilExternalAuthUserAttributeMappingRule::class)
28 ->disableOriginalConstructor()
29 ->getMock();
30 $rule
31 ->method('getExternalAttribute')
32 ->willReturn($externalAttributeReference);
33 $rule
34 ->method('getAttribute')
35 ->willReturn($externalAttributeReference);
36
37 return $rule;
38 }

Referenced by testExceptionIsRaisedForNonScalarValues(), testExceptionIsRaisedIfAnExpectedAttributeIsMissing(), testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex(), testValueGivenAsArrayCanBeRetrievedForExternalAttribute(), testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex(), and testValueGivenAsStringCanBeRetrievedForExternalAttribute().

+ Here is the caller graph for this function:

◆ testExceptionIsRaisedForNonScalarValues()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedForNonScalarValues ( )

Definition at line 113 of file ilSamlMappedUserAttributeValueParserTest.php.

113 : void
114 {
115 $this->expectException(ilSamlException::class);
116
117 $expectedValue = ['ILIAS'];
118 $expectedValueIndex = 5;
119
120 $attributeKey = 'firstname';
121 $attributeValue = [$expectedValueIndex => $expectedValue];
122
123 $userData = [$attributeKey => $attributeValue];
124
126 $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
127 $userData
128 );
129 $parser->parse();
130 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedAttributeIsMissing()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedAttributeIsMissing ( )

Definition at line 83 of file ilSamlMappedUserAttributeValueParserTest.php.

83 : void
84 {
85 $this->expectException(ilSamlException::class);
86
87 $attributeKey = 'firstname';
88 $userData = [];
89
90 $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
91 $parser->parse();
92 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex ( )

Definition at line 94 of file ilSamlMappedUserAttributeValueParserTest.php.

94 : void
95 {
96 $this->expectException(ilSamlException::class);
97
98 $expectedValue = 'ILIAS';
99 $expectedValueIndex = 5;
100
101 $attributeKey = 'firstname';
102 $attributeValue = [($expectedValueIndex + 1) => $expectedValue];
103
104 $userData = [$attributeKey => $attributeValue];
105
107 $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
108 $userData
109 );
110 $parser->parse();
111 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttribute ( )

Definition at line 53 of file ilSamlMappedUserAttributeValueParserTest.php.

53 : void
54 {
55 $expectedValue = 'ILIAS';
56
57 $attributeKey = 'firstname';
58 $attributeValue = [$expectedValue];
59
60 $userData = [$attributeKey => $attributeValue];
61
62 $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
63 $this->assertSame($expectedValue, $parser->parse());
64 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex ( )

Definition at line 66 of file ilSamlMappedUserAttributeValueParserTest.php.

66 : void
67 {
68 $expectedValue = 'ILIAS';
69 $expectedValueIndex = 5;
70
71 $attributeKey = 'firstname';
72 $attributeValue = [$expectedValueIndex => $expectedValue];
73
74 $userData = [$attributeKey => $attributeValue];
75
77 $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
78 $userData
79 );
80 $this->assertSame($expectedValue, $parser->parse());
81 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsStringCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsStringCanBeRetrievedForExternalAttribute ( )

Definition at line 40 of file ilSamlMappedUserAttributeValueParserTest.php.

40 : void
41 {
42 $expectedValue = 'ILIAS';
43
44 $attributeKey = 'firstname';
45 $attributeValue = $expectedValue;
46
47 $userData = [$attributeKey => $attributeValue];
48
49 $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
50 $this->assertSame($expectedValue, $parser->parse());
51 }

References getMappingRuleMock().

+ Here is the call graph for this function:

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