diff --git a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php
index 5227e0f6752901a757e60d1e6123b2785d15261e..9652c22ae035cce473a3eefb3765be00d35947bd 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php
@@ -81,6 +81,34 @@ class AttributeAlterTest extends TestCase
     }
 
 
+    /**
+     * Test the most basic functionality with merging strategy.
+     */
+    public function testMergeWithTarget(): void
+    {
+        $config = [
+            'subject' => 'test',
+            'target' => 'test2',
+            'pattern' => '/wrong/',
+            'replacement' => 'right',
+            '%merge'
+        ];
+
+        $request = [
+            'Attributes' => [
+                 'test' => ['wrong'],
+                 'test2' => ['somethingelse'],
+             ],
+        ];
+
+        $result = self::processFilter($config, $request);
+        $attributes = $result['Attributes'];
+        $this->assertArrayHasKey('test2', $attributes);
+        $this->assertEquals($attributes['test'], ['wrong']);
+        $this->assertEquals($attributes['test2'], ['right', 'somethingelse']);
+    }
+
+
     /**
      * Module is a no op if subject attribute is not present.
      */
@@ -155,6 +183,31 @@ class AttributeAlterTest extends TestCase
     }
 
 
+    /**
+     * Test replacing attribute value with merging strategy.
+     */
+    public function testReplaceMergeMatchWithTarget(): void
+    {
+        $config = [
+            'subject' => 'source',
+            'pattern' => '/wrong/',
+            'replacement' => 'right',
+            'target' => 'test',
+            '%replace',
+            '%merge',
+        ];
+        $request = [
+            'Attributes' => [
+                'source' => ['wrong'],
+                'test'   => ['wrong', 'somethingelse'],
+            ],
+        ];
+        $result = self::processFilter($config, $request);
+        $attributes = $result['Attributes'];
+        $this->assertEquals($attributes['test'], ['somethingelse', 'right']);
+    }
+
+
     /**
      * Test replacing attribute values.
      */