Skip to content

Commit

Permalink
ESDEV-4541 Change globExpressionList definition
Browse files Browse the repository at this point in the history
Feedback/request to change from review.

As empty filter and null filter does not have different behaviour
there is no need to have null filter available.
  • Loading branch information
rezonanc-oxid committed Jun 13, 2017
1 parent dbdb8d9 commit f270589
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/Utilities/CopyFileManager/CopyGlobFilteredFileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ class CopyGlobFilteredFileManager
/**
* Copy files/directories from source to destination.
*
* @param string $sourcePath Absolute path to file or directory.
* @param string $destinationPath Absolute path to file or directory.
* @param array|null $globExpressionList List of glob expressions, e.g. ["*.txt", "*.pdf"].
* @param string $sourcePath Absolute path to file or directory.
* @param string $destinationPath Absolute path to file or directory.
* @param array $globExpressionList List of glob expressions, e.g. ["*.txt", "*.pdf"].
*
* @throws \InvalidArgumentException If given $sourcePath is not a string.
* @throws \InvalidArgumentException If given $destinationPath is not a string.
*
* @return null
*/
public static function copy($sourcePath, $destinationPath, $globExpressionList = null)
public static function copy($sourcePath, $destinationPath, $globExpressionList = [])
{
if (!is_string($sourcePath)) {
$message = "Given value \"$sourcePath\" is not a valid source path entry. ".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class CopyGlobFilteredFileManagerTest extends \PHPUnit_Framework_TestCase
{
/** @var array */
private $filter;
private $filter = [];

public function testBasicFileCopyOperation()
{
Expand Down Expand Up @@ -167,21 +167,6 @@ public function testSingleFileCopyFilteringOperation()
$this->assertFilesNotExistInDestination(['modules.txt']);
}

public function testSingleFileCopyFilteringOperationWhenNoFilterIsDefined()
{
$inputFiles = [
"module.txt" => "TXT_1",
];

$this->prepareVirtualFileSystem($inputFiles, []);

$this->setFilter(null);
$this->simulateCopyWithFilter('module.txt', 'module.txt');

$this->assertFilesExistInSource(['module.txt']);
$this->assertFilesNotExistInDestination(['modules.txt']);
}

public function testSingleFileCopyFilteringOperationWhenFilterIsEmpty()
{
$inputFiles = [
Expand Down

0 comments on commit f270589

Please sign in to comment.