ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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  }
+ Here is the caller graph for this function:

◆ testExceptionIsRaisedForNonScalarValues()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedForNonScalarValues ( )

Definition at line 117 of file ilSamlMappedUserAttributeValueParserTest.php.

References getMappingRuleMock().

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  }
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedAttributeIsMissing()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedAttributeIsMissing ( )

Definition at line 87 of file ilSamlMappedUserAttributeValueParserTest.php.

References getMappingRuleMock().

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  }
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex ( )

Definition at line 98 of file ilSamlMappedUserAttributeValueParserTest.php.

References getMappingRuleMock().

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  }
+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttribute ( )

Definition at line 57 of file ilSamlMappedUserAttributeValueParserTest.php.

References getMappingRuleMock().

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  }
+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex ( )

Definition at line 70 of file ilSamlMappedUserAttributeValueParserTest.php.

References getMappingRuleMock().

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  }
+ Here is the call graph for this function:

◆ testValueGivenAsStringCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsStringCanBeRetrievedForExternalAttribute ( )

Definition at line 44 of file ilSamlMappedUserAttributeValueParserTest.php.

References getMappingRuleMock().

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  }
+ Here is the call graph for this function:

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