summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-10-20 17:11:08 +0200
committerVincent Petry <pvince81@owncloud.com>2014-10-20 17:11:08 +0200
commit51976b2729a496cb2aa79d844f00d27112a66930 (patch)
treed6183c044bef7770f9f881317904b71e940b4fe9 /tests
parent4ce3c25c5c90725e203a8fc2ab24eb5d7cc514bb (diff)
downloadnextcloud-server-51976b2729a496cb2aa79d844f00d27112a66930.tar.gz
nextcloud-server-51976b2729a496cb2aa79d844f00d27112a66930.zip
Add proper setup and teardown
Properly restore REQUEST_URI and SCRIPT_NAME after test runs
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/templatelayout.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/templatelayout.php b/tests/lib/templatelayout.php
index 87e5f1b50bd..0335c7c88ee 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