ILIAS  release_8 Revision v8.24
ilSamlMappedUserAttributeValueParserTest Class Reference

Class ilSamlMappedUserAttributeValueParserTest. More...

+ 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

Member Function Documentation

◆ getMappingRuleMock()

ilSamlMappedUserAttributeValueParserTest::getMappingRuleMock ( string  $externalAttributeReference)
protected

Definition at line 29 of file ilSamlMappedUserAttributeValueParserTest.php.

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

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

+ Here is the caller graph for this function:

◆ testExceptionIsRaisedForNonScalarValues()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedForNonScalarValues ( )

Definition at line 117 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedAttributeIsMissing()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedAttributeIsMissing ( )

Definition at line 87 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex ( )

Definition at line 98 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttribute ( )

Definition at line 57 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex ( )

Definition at line 70 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsStringCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsStringCanBeRetrievedForExternalAttribute ( )

Definition at line 44 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

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