Skip to content

Commit

Permalink
fix provider to treat path always as directory
Browse files Browse the repository at this point in the history
  • Loading branch information
laufhannes committed Aug 26, 2016
1 parent 59abba0 commit d75f371
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/Provider/AbstractFileProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ public function __construct($pathToFiles, InterpolationInterface $interpolation
$this->PathToFiles = $pathToFiles;
$this->Interpolation = $interpolation;

$this->addSlashToPathIfNotThere();
$this->initResourceReader();
}

private function addSlashToPathIfNotThere()
{
if (substr($this->PathToFiles, -1) != '/') {
$this->PathToFiles .= '/';
}
}

/**
* @param InterpolationInterface $interpolation
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Provider/GeoTIFF/SRTM4ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class SRTM4ProviderTest extends \PHPUnit_Framework_TestCase
{
/** @var string */
const PATH_TO_FILES = '/../../../../tests/testfiles/';
const PATH_TO_FILES = '/../../../../tests/testfiles';

/**
* @var SRTM4Provider
Expand Down Expand Up @@ -46,7 +46,7 @@ protected function checkFile($filename)
*/
protected function fileIsThere($filename)
{
return file_exists(__DIR__.self::PATH_TO_FILES.$filename);
return file_exists(__DIR__.self::PATH_TO_FILES.'/'.$filename);
}

public function testThatLocationOutOfBoundsIsRecognized()
Expand Down

0 comments on commit d75f371

Please sign in to comment.