Skip to content

Commit

Permalink
fix assertion to support hhvm error message
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed May 11, 2017
1 parent 1157c31 commit d83f584
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/DatapackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testNonExistantFileShouldFail()
{
$this->assertDatapackageException(
"frictionlessdata\\datapackage\\Exceptions\\DatapackageInvalidSourceException",
'Failed to load source: "-invalid-": file_get_contents(-invalid-): failed to open stream: No such file or directory',
'Failed to load source: "-invalid-": '.$this->getFileGetContentsErrorMessage("-invalid-"),
function() { Factory::datapackage("-invalid-"); }
);
}
Expand Down Expand Up @@ -381,4 +381,14 @@ protected function getFopenErrorMessage($in)
}
throw new \Exception();
}

protected function getFileGetContentsErrorMessage($in)
{
try {
file_get_contents($in);
} catch (\Exception $e) {
return $e->getMessage();
}
throw new \Exception();
}
}

0 comments on commit d83f584

Please sign in to comment.