Permalink
Browse files

ZendTest\Filter: assertRegExp bugfixes for windows

  • Loading branch information...
1 parent 493f467 commit 8f364ae9e229469ad72a312165d69bddeaab43ff @ThaDafinser committed Oct 28, 2013
Showing with 10 additions and 10 deletions.
  1. +2 −2 tests/ZendTest/Filter/File/RenameTest.php
  2. +8 −8 tests/ZendTest/Filter/File/RenameUploadTest.php
@@ -491,7 +491,7 @@ public function testGetRandomizedFile()
$filter->getFile()
);
$fileNoExt = $this->_filesPath . 'newfile';
- $this->assertRegExp('#' . $fileNoExt . '_.{13}\.xml#', $filter->getNewName($this->_oldFile));
+ $this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}\.xml#', $filter->getNewName($this->_oldFile));
}
/**
@@ -515,7 +515,7 @@ public function testGetRandomizedFileWithoutExtension()
)),
$filter->getFile()
);
- $this->assertRegExp('#' . $fileNoExt . '_.{13}#', $filter->getNewName($this->_oldFile));
+ $this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}#', $filter->getNewName($this->_oldFile));
}
/**
@@ -245,18 +245,18 @@ public function testCannotOverwriteExistingFile()
*/
public function testGetRandomizedFile()
{
- $fileNoExt = $this->_filesPath . '/newfile';
+ $fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $this->_newFile,
'randomize' => true,
));
- $this->assertRegExp('#' . $fileNoExt . '_.{13}\.xml#', $filter($this->_oldFile));
+ $this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}\.xml#', $filter($this->_oldFile));
}
public function testGetFileWithOriginalExtension()
{
- $fileNoExt = $this->_filesPath . '/newfile';
+ $fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $this->_newFile,
'use_upload_extension' => true,
@@ -266,14 +266,14 @@ public function testGetFileWithOriginalExtension()
$oldFilePathInfo = pathinfo($this->_oldFile);
$this->assertRegExp(
- '#' . $fileNoExt . '.'.$oldFilePathInfo['extension'].'#',
+ '#' . str_replace('\\', '\\\\', $fileNoExt) . '.'.$oldFilePathInfo['extension'].'#',
$filter($this->_oldFile)
);
}
public function testGetRandomizedFileWithOriginalExtension()
{
- $fileNoExt = $this->_filesPath . '/newfile';
+ $fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $this->_newFile,
'use_upload_extension' => true,
@@ -283,7 +283,7 @@ public function testGetRandomizedFileWithOriginalExtension()
$oldFilePathInfo = pathinfo($this->_oldFile);
$this->assertRegExp(
- '#' . $fileNoExt . '_.{13}\.'.$oldFilePathInfo['extension'].'#',
+ '#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}\.'.$oldFilePathInfo['extension'].'#',
$filter($this->_oldFile)
);
}
@@ -293,13 +293,13 @@ public function testGetRandomizedFileWithOriginalExtension()
*/
public function testGetRandomizedFileWithoutExtension()
{
- $fileNoExt = $this->_filesPath . '/newfile';
+ $fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $fileNoExt,
'randomize' => true,
));
- $this->assertRegExp('#' . $fileNoExt . '_.{13}#', $filter($this->_oldFile));
+ $this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}#', $filter($this->_oldFile));
}
/**

0 comments on commit 8f364ae

Please sign in to comment.