ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 assertException ($exception_class)
 
 getMappingRuleMock ($externalAttributeReference)
 

Detailed Description

Member Function Documentation

◆ assertException()

ilSamlMappedUserAttributeValueParserTest::assertException (   $exception_class)
protected
Parameters
string$exception_class

Definition at line 12 of file ilSamlMappedUserAttributeValueParserTest.php.

Referenced by testExceptionIsRaisedForNonScalarValues(), testExceptionIsRaisedIfAnExpectedAttributeIsMissing(), and testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex().

13  {
14  if (version_compare(PHPUnit_Runner_Version::id(), '5.0', '>=')) {
15  $this->setExpectedException($exception_class);
16  }
17  }
+ Here is the caller graph for this function:

◆ getMappingRuleMock()

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

Definition at line 23 of file ilSamlMappedUserAttributeValueParserTest.php.

References $rule.

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

24  {
25  $rule = $this->getMockBuilder(ilExternalAuthUserAttributeMappingRule::class)->disableOriginalConstructor()->getMock();
26  $rule->expects($this->any())->method('getExternalAttribute')->will($this->returnValue($externalAttributeReference));
27  $rule->expects($this->any())->method('getAttribute')->will($this->returnValue($externalAttributeReference));
28 
29  return $rule;
30  }
$rule
Definition: showstats.php:43
+ Here is the caller graph for this function:

◆ testExceptionIsRaisedForNonScalarValues()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedForNonScalarValues ( )

Definition at line 105 of file ilSamlMappedUserAttributeValueParserTest.php.

References $parser, array, assertException(), and getMappingRuleMock().

106  {
107  $this->assertException(ilSamlException::class);
108 
109  $expectedValue = array('ILIAS');
110  $expectedValueIndex = 5;
111 
112  $attributeKey = 'firstname';
113  $attributeValue = [$expectedValueIndex => $expectedValue];
114 
115  $userData = [$attributeKey => $attributeValue];
116 
118  $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
119  $userData
120  );
121  $parser->parse();
122  }
Create styles array
The data for the language used.
$parser
Definition: BPMN2Parser.php:23
Class ilSamlMappedUserAttributeValueParser.
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedAttributeIsMissing()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedAttributeIsMissing ( )

Definition at line 75 of file ilSamlMappedUserAttributeValueParserTest.php.

References $parser, assertException(), and getMappingRuleMock().

76  {
77  $this->assertException(ilSamlException::class);
78 
79  $attributeKey = 'firstname';
80  $userData = [];
81 
82  $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
83  $parser->parse();
84  }
$parser
Definition: BPMN2Parser.php:23
Class ilSamlMappedUserAttributeValueParser.
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex()

ilSamlMappedUserAttributeValueParserTest::testExceptionIsRaisedIfAnExpectedValueCouldNotBeFoundForAnExpectedValueIndex ( )

Definition at line 86 of file ilSamlMappedUserAttributeValueParserTest.php.

References $parser, assertException(), and getMappingRuleMock().

87  {
88  $this->assertException(ilSamlException::class);
89 
90  $expectedValue = 'ILIAS';
91  $expectedValueIndex = 5;
92 
93  $attributeKey = 'firstname';
94  $attributeValue = [($expectedValueIndex + 1) => $expectedValue];
95 
96  $userData = [$attributeKey => $attributeValue];
97 
99  $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
100  $userData
101  );
102  $parser->parse();
103  }
$parser
Definition: BPMN2Parser.php:23
Class ilSamlMappedUserAttributeValueParser.
+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttribute ( )

Definition at line 45 of file ilSamlMappedUserAttributeValueParserTest.php.

References $parser, and getMappingRuleMock().

46  {
47  $expectedValue = 'ILIAS';
48 
49  $attributeKey = 'firstname';
50  $attributeValue = [$expectedValue];
51 
52  $userData = [$attributeKey => $attributeValue];
53 
54  $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
55  $this->assertEquals($expectedValue, $parser->parse());
56  }
$parser
Definition: BPMN2Parser.php:23
Class ilSamlMappedUserAttributeValueParser.
+ Here is the call graph for this function:

◆ testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsArrayCanBeRetrievedForExternalAttributeWithSpecificIndex ( )

Definition at line 58 of file ilSamlMappedUserAttributeValueParserTest.php.

References $parser, and getMappingRuleMock().

59  {
60  $expectedValue = 'ILIAS';
61  $expectedValueIndex = 5;
62 
63  $attributeKey = 'firstname';
64  $attributeValue = [$expectedValueIndex => $expectedValue];
65 
66  $userData = [$attributeKey => $attributeValue];
67 
69  $this->getMappingRuleMock($attributeKey . '|' . $expectedValueIndex),
70  $userData
71  );
72  $this->assertEquals($expectedValue, $parser->parse());
73  }
$parser
Definition: BPMN2Parser.php:23
Class ilSamlMappedUserAttributeValueParser.
+ Here is the call graph for this function:

◆ testValueGivenAsStringCanBeRetrievedForExternalAttribute()

ilSamlMappedUserAttributeValueParserTest::testValueGivenAsStringCanBeRetrievedForExternalAttribute ( )

Definition at line 32 of file ilSamlMappedUserAttributeValueParserTest.php.

References $parser, and getMappingRuleMock().

33  {
34  $expectedValue = 'ILIAS';
35 
36  $attributeKey = 'firstname';
37  $attributeValue = $expectedValue;
38 
39  $userData = [$attributeKey => $attributeValue];
40 
41  $parser = new ilSamlMappedUserAttributeValueParser($this->getMappingRuleMock($attributeKey), $userData);
42  $this->assertEquals($expectedValue, $parser->parse());
43  }
$parser
Definition: BPMN2Parser.php:23
Class ilSamlMappedUserAttributeValueParser.
+ Here is the call graph for this function:

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