Skip to content
Snippets Groups Projects
Commit 51976b27 authored by Vincent Petry's avatar Vincent Petry
Browse files

Add proper setup and teardown

Properly restore REQUEST_URI and SCRIPT_NAME after test runs
parent 4ce3c25c
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,23 @@ namespace OC\Test; ...@@ -13,6 +13,23 @@ namespace OC\Test;
*/ */
class OC_TemplateLayout extends \PHPUnit_Framework_TestCase { 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) * Contains valid file paths in the scheme array($absolutePath, $expectedPath)
* @return array * @return array
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment