diff --git a/build/integration/composer.json b/build/integration/composer.json
index 2f0f8a815cec0fb11946f5e6c51857db9d3b3c3b..a9516391a410b4e31fd139e9486814104929c65e 100644
--- a/build/integration/composer.json
+++ b/build/integration/composer.json
@@ -3,6 +3,7 @@
     "phpunit/phpunit": "~4.6",
     "behat/behat": "^3.0",
     "guzzlehttp/guzzle": "~5.0",
-    "jarnaiz/behat-junit-formatter": "^1.3"
+    "jarnaiz/behat-junit-formatter": "^1.3",
+    "sabre/dav": "3.0.x-dev"    
   }
 }
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index 01a288a6c6a17bd60466f81e228dd624d6b15851..bf3b1d50814b1a968bb067d11cb8bf8742488378 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -152,6 +152,14 @@ trait BasicStructure{
 		if (!file_exists("../../core/skeleton/FOLDER")) {
 			mkdir("../../core/skeleton/FOLDER", 0777, true);
 		}
+		if (!file_exists("../../core/skeleton/PARENT")) {
+			mkdir("../../core/skeleton/PARENT", 0777, true);
+		}
+		file_put_contents("../../core/skeleton/PARENT/" . "parent.txt", "ownCloud test text file\n");
+		if (!file_exists("../../core/skeleton/PARENT/CHILD")) {
+			mkdir("../../core/skeleton/PARENT/CHILD", 0777, true);
+		}
+		file_put_contents("../../core/skeleton/PARENT/CHILD/" . "child.txt", "ownCloud test text file\n");
 
 	}
 
@@ -165,6 +173,16 @@ trait BasicStructure{
 		if (is_dir("../../core/skeleton/FOLDER")) {
 			rmdir("../../core/skeleton/FOLDER");
 		}
+		self::removeFile("../../core/skeleton/PARENT/CHILD/", "child.txt");
+		if (is_dir("../../core/skeleton/PARENT/CHILD")) {
+			rmdir("../../core/skeleton/PARENT/CHILD");
+		}
+		self::removeFile("../../core/skeleton/PARENT/", "parent.txt");
+		if (is_dir("../../core/skeleton/PARENT")) {
+			rmdir("../../core/skeleton/PARENT");
+		}
+
+
 	}
 }
 
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index 1bda8175eeb5b45ace4abd37481f59d8c7a21344..f38c7bec754138b95dfed86cb2d3806eff104f58 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -2,8 +2,9 @@
 
 use Behat\Behat\Context\Context;
 use Behat\Behat\Context\SnippetAcceptingContext;
-use GuzzleHttp\Client;
+use GuzzleHttp\Client as GClient;
 use GuzzleHttp\Message\ResponseInterface;
+use Sabre\DAV\Client as SClient;
 
 require __DIR__ . '/../../vendor/autoload.php';
 
@@ -22,7 +23,7 @@ trait WebDav{
 
 	public function makeDavRequest($user, $method, $path, $headers){
 		$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path";
-		$client = new Client();
+		$client = new GClient();
 		$options = [];
 		if ($user === 'admin') {
 			$options['auth'] = $this->adminUser;
@@ -30,10 +31,11 @@ trait WebDav{
 			$options['auth'] = [$user, $this->regularUser];
 		}
 		$request = $client->createRequest($method, $fullUrl, $options);
-		foreach ($headers as $key => $value) {
-			$request->addHeader($key, $value);	
+		if (!is_null($headers)){
+			foreach ($headers as $key => $value) {
+				$request->addHeader($key, $value);	
+			}
 		}
-		//$this->response = $client->send($request);
 		return $client->send($request);
 	}
 
@@ -56,5 +58,43 @@ trait WebDav{
 		$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
 	}
 
+	public function listFolder($user, $path){
+		$fullUrl = substr($this->baseUrl, 0, -4);
+
+		$settings = array(
+			'baseUri' => $fullUrl,
+			'userName' => $user,
+		);
+
+		echo "password del admin: " . $this->adminUser[1] . "\n";
+		echo "fullUrl: " . $fullUrl . "\n";
+
+		if ($user === 'admin') {
+			$settings['password'] = $this->adminUser[1];
+		} else {
+			$settings['password'] = $this->regularUser;
+		}
+
+		$client = new SClient($settings);
+
+		$response = $client->propfind($this->davPath . "/", array(
+			'{DAV:}displayname',
+		));
+
+		print_r($response);
+		/*$features = $client->options();
+
+		print_r($features);*/
+		//return $this->response->xml();
+	}
+
+	/**
+	 * @Then /^user "([^"]*)" should see following folders$/
+	 */
+	public function checkList($user){
+		$this->listFolder($user, '/');
+	}
+	
+
 }
 
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index 32bb943d2d7fe0a3a9f7da9ffb6b47d9c897004d..fc2da430663c0f684c3c4e347a7f587d1a4d8b54 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -363,6 +363,18 @@ Feature: sharing
     Then the OCS status code should be "404" 
     And the HTTP status code should be "200"
 
+  Scenario: Share of folder and sub-folder to same user - core#20645
+    Given As an "admin"
+    And user "user0" exists
+    And user "user1" exists
+    And group "group0" exists
+    And user "user1" belongs to group "group0"
+    And file "/PARENT" from user "user0" is shared with user "user1"
+    When file "/PARENT/CHILD" from user "user0" is shared with group "group0"
+    And As an "admin"
+    Then user "user1" should see following folders
+    And the HTTP status code should be "200"
+
   Scenario: Delete all group shares
     Given As an "admin"
     And user "user0" exists