[Pkg-owncloud-commits] [owncloud] 32/46: Add proper setup and teardown

David Prévot taffit at moszumanska.debian.org
Fri Oct 24 15:11:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 3e02e79154543c4f9346790732e100ede932c913
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Mon Oct 20 17:11:08 2014 +0200

    Add proper setup and teardown
    
    Properly restore REQUEST_URI and SCRIPT_NAME after test runs
---
 tests/lib/templatelayout.php | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/lib/templatelayout.php b/tests/lib/templatelayout.php
index 87e5f1b..0335c7c 100644
--- a/tests/lib/templatelayout.php
+++ b/tests/lib/templatelayout.php
@@ -13,6 +13,23 @@ namespace OC\Test;
  */
 class OC_TemplateLayout extends \PHPUnit_Framework_TestCase {
 
+	private $oldServerUri;
+	private $oldScriptName;
+
+	public function setUp() {
+		$this->oldServerURI = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
+		$this->oldScriptName = $_SERVER['SCRIPT_NAME'];
+	}
+
+	public function tearDown() {
+		if ($this->oldServerURI === null) {
+			unset($_SERVER['REQUEST_URI']);
+		} else {
+			$_SERVER['REQUEST_URI'] = $this->oldServerURI;
+		}
+		$_SERVER['SCRIPT_NAME'] = $this->oldScriptName;
+	}
+
 	/**
 	 * Contains valid file paths in the scheme array($absolutePath, $expectedPath)
 	 * @return array

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list