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

Commit

Permalink
changing test to be less sensitive on pathing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Orcutt committed Mar 22, 2018
1 parent 168ae79 commit f1fd919
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/Zynga/Framework/Database/V2/Mock/ResultSets.hh
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,36 @@ class ResultSets {

}

public function getFileNameForTest(string $class, string $functionName): string {

$fileName = CodePath::getRoot();
$fileName .=
'/tests/data/'.str_replace('\\', '/', $class).'/'.$functionName.'.data';

if ( is_file($fileName) ) {
return $fileName;
}

$frameworkFile = dirname(__FILE__);
$frameworkFile = dirname($frameworkFile); // Mock
$frameworkFile = dirname($frameworkFile); // V2
$frameworkFile = dirname($frameworkFile); // Database
$frameworkFile = dirname($frameworkFile); // Framework
$frameworkFile = dirname($frameworkFile); // Zynga
$frameworkFile = dirname($frameworkFile); // src
$frameworkFile .=
'/tests/data/'.str_replace('\\', '/', $class).'/'.$functionName.'.data';

return $frameworkFile;

}

public function loadResultsForTest(
string $class,
string $functionName,
): bool {

$fileName = CodePath::getRoot();
$fileName .=
'/tests/data/'.str_replace('\\', '/', $class).'/'.$functionName.'.data';
$fileName = $this->getFileNameForTest($class, $functionName);

try {

Expand Down

0 comments on commit f1fd919

Please sign in to comment.