ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ($externalAttributeReference)
 

Detailed Description

Member Function Documentation

◆ getMappingRuleMock()

ilSamlMappedUserAttributeValueParserTest::getMappingRuleMock (   $externalAttributeReference)
protected
Parameters
$externalAttributeReference
Returns
\ilExternalAuthUserAttributeMappingRule

Definition at line 15 of file ilSamlMappedUserAttributeValueParserTest.php.

16 {
17 $rule = $this->getMockBuilder(ilExternalAuthUserAttributeMappingRule::class)->disableOriginalConstructor()->getMock();
18 $rule->expects($this->any())->method('getExternalAttribute')->will($this->returnValue($externalAttributeReference));
19 $rule->expects($this->any())->method('getAttribute')->will($this->returnValue($externalAttributeReference));
20
21 return $rule;
22 }

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

+ Here is the caller graph for this function:

◆ testExceptionIsRaisedForNonScalarValues()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedForNonScalarValues ( )

Definition at line 97 of file ilSamlMappedUserAttributeValueParserTest.php.

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

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedAttributeIsMissing()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedAttributeIsMissing ( )

Definition at line 67 of file ilSamlMappedUserAttributeValueParserTest.php.

68 {
69 $this->expectException(ilSamlException::class);
70
71 $attributeKey = 'firstname';
72 $userData = [];
73
74 $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
75 $parser->parse();
76 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex ( )

Definition at line 78 of file ilSamlMappedUserAttributeValueParserTest.php.

79 {
80 $this->expectException(ilSamlException::class);
81
82 $expectedValue = 'ILIAS';
83 $expectedValueIndex = 5;
84
85 $attributeKey = 'firstname';
86 $attributeValue = [($expectedValueIndex + 1) => $expectedValue];
87
88 $userData = [$attributeKey => $attributeValue];
89
91 $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
92 $userData
93 );
94 $parser->parse();
95 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttribute ( )

Definition at line 37 of file ilSamlMappedUserAttributeValueParserTest.php.

38 {
39 $expectedValue = 'ILIAS';
40
41 $attributeKey = 'firstname';
42 $attributeValue = [$expectedValue];
43
44 $userData = [$attributeKey => $attributeValue];
45
46 $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
47 $this->assertEquals($expectedValue, $parser->parse());
48 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex ( )

Definition at line 50 of file ilSamlMappedUserAttributeValueParserTest.php.

51 {
52 $expectedValue = 'ILIAS';
53 $expectedValueIndex = 5;
54
55 $attributeKey = 'firstname';
56 $attributeValue = [$expectedValueIndex => $expectedValue];
57
58 $userData = [$attributeKey => $attributeValue];
59
61 $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
62 $userData
63 );
64 $this->assertEquals($expectedValue, $parser->parse());
65 }

References getMappingRuleMock().

+ Here is the call graph for this function:

◆ testValueGivenAsStringCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsStringCanBeRetrievedForExternalAttribute ( )

Definition at line 24 of file ilSamlMappedUserAttributeValueParserTest.php.

25 {
26 $expectedValue = 'ILIAS';
27
28 $attributeKey = 'firstname';
29 $attributeValue = $expectedValue;
30
31 $userData = [$attributeKey => $attributeValue];
32
33 $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
34 $this->assertEquals($expectedValue, $parser->parse());
35 }

References getMappingRuleMock().

+ Here is the call graph for this function:

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