From ceabb113da3e27a60800ce5fd5516702a7daaffb Mon Sep 17 00:00:00 2001
From: Thijs Kinkhorst <thijs@kinkhorst.com>
Date: Thu, 13 Aug 2015 18:19:19 +0000
Subject: [PATCH] Also test some lines missed with these tests

---
 .../lib/Auth/Process/AttributeAddTest.php     |  2 +-
 .../lib/Auth/Process/ScopeAttributeTest.php   | 25 ++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php
index 95733aeaf..3db1f388d 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 ef3873ea2..31e151636 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
      */
-- 
GitLab