From 69ca3a70d674c7c7599a4523c41fd87aa2adb3df Mon Sep 17 00:00:00 2001
From: Sergio Bertolin <sbertolin@solidgear.es>
Date: Mon, 30 Nov 2015 14:07:02 +0000
Subject: [PATCH] Added webdav test to check range downloads

---
 build/integration/features/bootstrap/WebDav.php  | 16 ++++++++++++++++
 .../integration/features/webdav-related.feature  |  6 ++++++
 2 files changed, 22 insertions(+)

diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index 2bbe44e9c59..567f189c61e 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -58,6 +58,22 @@ trait WebDav{
 		$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
 	}
 
+	/**
+	 * @When /^Downloading file "([^"]*)" with range "([^"]*)"$/
+	 */
+	public function downloadFileWithRange($fileSource, $range){
+		$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
+		$headers['Range'] = $range;
+		$this->response = $this->makeDavRequest($this->currentUser, "GET", $fileSource, $headers);
+	}
+
+	/**
+	 * @Then /^Downloaded content should be "([^"]*)"$/
+	 */
+	public function downloadedContentShouldBe($content){
+		PHPUnit_Framework_Assert::assertEquals($content, (string)$this->response->getBody());
+	}
+
 	/*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/
 	public function listFolder($user, $path, $folderDepth){
 		$fullUrl = substr($this->baseUrl, 0, -4);
diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature
index 961b6b03431..16955e27063 100644
--- a/build/integration/features/webdav-related.feature
+++ b/build/integration/features/webdav-related.feature
@@ -9,6 +9,12 @@ Feature: sharing
 		When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
 		Then the HTTP status code should be "201"
 
+	Scenario: download a file with range
+		Given using dav path "remote.php/webdav"
+		And As an "admin"
+		When Downloading file "/welcome.txt" with range "bytes=51-77"
+		Then Downloaded content should be "example file for developers"
+
 
 
 
-- 
GitLab