Skip to content

Commit

Permalink
use short name for DIRECTORY_SEPARATOR
Browse files Browse the repository at this point in the history
  • Loading branch information
easy-system committed Jun 21, 2016
1 parent ee750bc commit 64fde27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Adapter/FileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ protected function getPath($variableName = '')
$hash = function ($name) {
return hash($this->hashingAlgorithm, $name);
};
$path = $this->basedir . DIRECTORY_SEPARATOR . $hash($this->namespace);
$path = $this->basedir . PHP_DS . $hash($this->namespace);
if ($variableName) {
$path .= DIRECTORY_SEPARATOR . $hash($variableName) . '.dat';
$path .= PHP_DS . $hash($variableName) . '.dat';

return $path;
}
Expand Down
12 changes: 6 additions & 6 deletions test/Adapter/FileCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FileCacheTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->tempDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'es-cache-test';
$this->tempDir = sys_get_temp_dir() . PHP_DS . 'es-cache-test';
if (file_exists($this->tempDir) && is_dir($this->tempDir)) {
if (! is_writable($this->tempDir)) {
$this->fail(sprintf(
Expand Down Expand Up @@ -55,7 +55,7 @@ public function testSetEnabledThrowsIfUnableToCreateBaseDir()
if (substr(PHP_OS, 0, 3) == 'WIN') {
$this->markTestSkipped('Not testable on windows.');
}
$protected = $this->tempDir . DIRECTORY_SEPARATOR . 'foo';
$protected = $this->tempDir . PHP_DS . 'foo';
mkdir($protected, 0400);
$options = [
'basedir' => $protected,
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testSetEnabledThrowsIfNamespaceDirIsNotWritable()
'basedir' => $this->tempDir,
'hashing_algorithm' => 'crc32',
];
$namespaceDir = $this->tempDir . DIRECTORY_SEPARATOR . hash('crc32', 'default');
$namespaceDir = $this->tempDir . PHP_DS . hash('crc32', 'default');
mkdir($namespaceDir, 0500, true);
$cache = new FileCache($options);
$this->setExpectedException('RuntimeException');
Expand All @@ -114,7 +114,7 @@ public function testSetEnabledThrowsIfNamespaceDirIsNotReadable()
'basedir' => $this->tempDir,
'hashing_algorithm' => 'crc32',
];
$namespaceDir = $this->tempDir . DIRECTORY_SEPARATOR . hash('crc32', 'default');
$namespaceDir = $this->tempDir . PHP_DS . hash('crc32', 'default');
mkdir($namespaceDir, 0300, true);
$cache = new FileCache($options);
$this->setExpectedException('RuntimeException');
Expand Down Expand Up @@ -542,9 +542,9 @@ protected function getPath(FileCache $cache, $fileName = '')
$hash = function ($name) use ($algorithm) {
return hash($algorithm, $name);
};
$path = $basedir . DIRECTORY_SEPARATOR . $hash($namespace);
$path = $basedir . PHP_DS . $hash($namespace);
if ($fileName) {
$path .= DIRECTORY_SEPARATOR . $hash($fileName) . '.dat';
$path .= PHP_DS . $hash($fileName) . '.dat';

return $path;
}
Expand Down

0 comments on commit 64fde27

Please sign in to comment.