/** * Test the normalizeAttributesArray() function. */ public function testNormalizeAttributesArray() { $attributes = array('key1' => 'value1', 'key2' => array('value2', 'value3'), 'key3' => 'value1'); $expected = array('key1' => array('value1'), 'key2' => array('value2', 'value3'), 'key3' => array('value1')); $this->assertEquals($expected, Attributes::normalizeAttributesArray($attributes), 'Attribute array normalization failed'); }
/** * Test that the getExpectedAttribute() method successfully obtains values from the attributes array. */ public function testGetExpectedAttribute() { // check one value $value = 'value'; $attributes = array('attribute' => array($value)); $expected = 'attribute'; $this->assertEquals($value, \SimpleSAML\Utils\Attributes::getExpectedAttribute($attributes, $expected)); // check multiple (allowed) values $value = 'value'; $attributes = array('attribute' => array($value, 'value2', 'value3')); $expected = 'attribute'; $this->assertEquals($value, \SimpleSAML\Utils\Attributes::getExpectedAttribute($attributes, $expected, true)); }