Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Fixed the super global test to load the test files realtively
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Orcutt committed Mar 22, 2018
1 parent 39d0af6 commit 168ae79
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,20 @@ class SuperGlobalsTest extends TestCase {
$this->assertTrue(SuperGlobals::clearRequest());
}

public function findTestDir(): string {
$testDir = dirname(__FILE__);
$testDir = dirname($testDir); // V1
$testDir = dirname($testDir); // SuperGlobals
$testDir = dirname($testDir); // Environment
$testDir = dirname($testDir); // Framework
$testDir = dirname($testDir); // Zynga
$testDir = dirname($testDir); // src
return $testDir;
}

public function test_getRequestBodyAsMap_Empty(): void {

$requestFile = CodePath::getRoot().'/tests/empty_request_body.js';
$requestFile = $this->findTestDir() . '/tests/empty_request_body.js';

SuperGlobals::setBodyFilePath($requestFile);

Expand All @@ -129,7 +140,7 @@ class SuperGlobalsTest extends TestCase {

public function test_getRequestBodyAsMap_SomeData(): void {

$requestFile = CodePath::getRoot().'/tests/some_data.js';
$requestFile = $this->findTestDir().'/tests/some_data.js';

SuperGlobals::setBodyFilePath($requestFile);

Expand Down

0 comments on commit 168ae79

Please sign in to comment.