diff --git a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php index 95733aeafec69cda1c64db3745de68f6bd6579dc..3db1f388d3fac58df6c3165c538b5724de355f5a 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php @@ -163,7 +163,7 @@ class Test_Core_Auth_Process_AttributeAdd extends PHPUnit_Framework_TestCase { $config = array( '%replace', - array('value2'), + true => array('value2'), ); $request = array( 'Attributes' => array( diff --git a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php index ef3873ea264d8209d9b2f793148cb68406234b0c..31e151636028a1901b710bd97011c0fbbbc4ff6a 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php @@ -43,7 +43,7 @@ class Test_Core_Auth_Process_ScopeAttribute extends PHPUnit_Framework_TestCase } /* - * If scope already set, module must add, not overwrite. + * If target attribute already set, module must add, not overwrite. */ public function testNoOverwrite() { @@ -64,6 +64,29 @@ class Test_Core_Auth_Process_ScopeAttribute extends PHPUnit_Framework_TestCase $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('library-walk-in@example.edu', 'member@example.com')); } + /* + * If same scope already set, module must do nothing, not duplicate value. + */ + public function testNoDuplication() + { + $config = array( + 'scopeAttribute' => 'eduPersonPrincipalName', + 'sourceAttribute' => 'eduPersonAffiliation', + 'targetAttribute' => 'eduPersonScopedAffiliation', + ); + $request = array( + 'Attributes' => array( + 'eduPersonPrincipalName' => array('jdoe@example.com'), + 'eduPersonAffiliation' => array('member'), + 'eduPersonScopedAffiliation' => array('member@example.com'), + ) + ); + $result = self::processFilter($config, $request); + $attributes = $result['Attributes']; + $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('member@example.com')); + } + + /* * If source attribute not set, nothing happens */