Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit b44c029

Browse files
committed
Merge branch 'hotfix/14' into develop
Forward port #14
2 parents 283a88f + b5f210b commit b44c029

File tree

6 files changed

+82
-40
lines changed

6 files changed

+82
-40
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file, in reverse chronological order by release.
4+
5+
## 2.5.2 - 2016-02-16
6+
7+
### Added
8+
9+
- Nothing.
10+
11+
### Deprecated
12+
13+
- Nothing.
14+
15+
### Removed
16+
17+
- Nothing.
18+
19+
### Fixed
20+
21+
- [#14](https://github.com/zendframework/zend-file/pull/14) updates the
22+
`FilterPluginManager` to work with the updated zend-filter 2.6.0 changes,
23+
fixing an issue where the zend-file filters were replacing (instead of
24+
merging) with those in the parent zend-filter implementation.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
"zendframework/zend-stdlib": "~2.5"
1818
},
1919
"require-dev": {
20-
"zendframework/zend-filter": "~2.5",
20+
"zendframework/zend-filter": "~2.6",
2121
"zendframework/zend-i18n": "~2.5",
2222
"zendframework/zend-servicemanager": "~2.5",
2323
"zendframework/zend-validator": "~2.5",
24+
"zendframework/zend-progressbar": "~2.5",
2425
"fabpot/php-cs-fixer": "1.7.*",
2526
"phpunit/PHPUnit": "~4.0"
2627
},

src/Transfer/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ public function hasErrors()
710710
public function addFilter($filter, $options = null, $files = null)
711711
{
712712
if (is_string($filter)) {
713+
$options = (null !== $options && is_scalar($options)) ? [$options] : $options;
713714
$filter = $this->getFilterManager()->get($filter, $options);
714715
}
715716

src/Transfer/Adapter/FilterPluginManager.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace Zend\File\Transfer\Adapter;
1111

1212
use Zend\Filter\FilterPluginManager as BaseManager;
13+
use Zend\Filter\File;
1314

1415
/**
1516
* Plugin manager implementation for the filter chain.
@@ -21,15 +22,25 @@
2122
class FilterPluginManager extends BaseManager
2223
{
2324
/**
24-
* Default set of filters
25+
* Constructor
2526
*
26-
* @var array
27+
* Merges default aliases pertinent to this plugin manager with those
28+
* defined in the parent filter plugin manager.
29+
*
30+
* @param null|\Zend\ServiceManager\ConfigInterface|\Interop\Container\ContainerInterface $configOrContainerInstance
31+
* @param array $v3config If $configOrContainerInstance is a container, this
32+
* value will be passed to the parent constructor.
2733
*/
28-
protected $aliases = [
29-
'decrypt' => 'filedecrypt',
30-
'encrypt' => 'fileencrypt',
31-
'lowercase' => 'filelowercase',
32-
'rename' => 'filerename',
33-
'uppercase' => 'fileuppercase',
34-
];
34+
public function __construct($configOrContainerInstance = null, array $v3config = [])
35+
{
36+
$this->aliases = array_merge([
37+
'decrypt' => File\Decrypt::class,
38+
'encrypt' => File\Encrypt::class,
39+
'lowercase' => File\LowerCase::class,
40+
'rename' => File\Rename::class,
41+
'uppercase' => File\UpperCase::class,
42+
], $this->aliases);
43+
44+
parent::__construct($configOrContainerInstance, $v3config);
45+
}
3546
}

test/Transfer/Adapter/AbstractTest.php

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -412,34 +412,31 @@ public function testAdapterShouldAllowRetrievingDestinationsForAnArrayOfSpecifie
412412

413413
public function testSettingAndRetrievingOptions()
414414
{
415-
$this->assertEquals(
416-
[
417-
'bar' => ['ignoreNoFile' => false, 'useByteString' => true],
418-
'baz' => ['ignoreNoFile' => false, 'useByteString' => true],
419-
'foo' => ['ignoreNoFile' => false, 'useByteString' => true, 'detectInfos' => true],
420-
'file_0_' => ['ignoreNoFile' => false, 'useByteString' => true],
421-
'file_1_' => ['ignoreNoFile' => false, 'useByteString' => true],
422-
], $this->adapter->getOptions());
415+
$this->assertEquals([
416+
'bar' => ['ignoreNoFile' => false, 'useByteString' => true],
417+
'baz' => ['ignoreNoFile' => false, 'useByteString' => true],
418+
'foo' => ['ignoreNoFile' => false, 'useByteString' => true, 'detectInfos' => true],
419+
'file_0_' => ['ignoreNoFile' => false, 'useByteString' => true],
420+
'file_1_' => ['ignoreNoFile' => false, 'useByteString' => true],
421+
], $this->adapter->getOptions());
423422

424423
$this->adapter->setOptions(['ignoreNoFile' => true]);
425-
$this->assertEquals(
426-
[
427-
'bar' => ['ignoreNoFile' => true, 'useByteString' => true],
428-
'baz' => ['ignoreNoFile' => true, 'useByteString' => true],
429-
'foo' => ['ignoreNoFile' => true, 'useByteString' => true, 'detectInfos' => true],
430-
'file_0_' => ['ignoreNoFile' => true, 'useByteString' => true],
431-
'file_1_' => ['ignoreNoFile' => true, 'useByteString' => true],
432-
], $this->adapter->getOptions());
424+
$this->assertEquals([
425+
'bar' => ['ignoreNoFile' => true, 'useByteString' => true],
426+
'baz' => ['ignoreNoFile' => true, 'useByteString' => true],
427+
'foo' => ['ignoreNoFile' => true, 'useByteString' => true, 'detectInfos' => true],
428+
'file_0_' => ['ignoreNoFile' => true, 'useByteString' => true],
429+
'file_1_' => ['ignoreNoFile' => true, 'useByteString' => true],
430+
], $this->adapter->getOptions());
433431

434432
$this->adapter->setOptions(['ignoreNoFile' => false], 'foo');
435-
$this->assertEquals(
436-
[
437-
'bar' => ['ignoreNoFile' => true, 'useByteString' => true],
438-
'baz' => ['ignoreNoFile' => true, 'useByteString' => true],
439-
'foo' => ['ignoreNoFile' => false, 'useByteString' => true, 'detectInfos' => true],
440-
'file_0_' => ['ignoreNoFile' => true, 'useByteString' => true],
441-
'file_1_' => ['ignoreNoFile' => true, 'useByteString' => true],
442-
], $this->adapter->getOptions());
433+
$this->assertEquals([
434+
'bar' => ['ignoreNoFile' => true, 'useByteString' => true],
435+
'baz' => ['ignoreNoFile' => true, 'useByteString' => true],
436+
'foo' => ['ignoreNoFile' => false, 'useByteString' => true, 'detectInfos' => true],
437+
'file_0_' => ['ignoreNoFile' => true, 'useByteString' => true],
438+
'file_1_' => ['ignoreNoFile' => true, 'useByteString' => true],
439+
], $this->adapter->getOptions());
443440
}
444441

445442
public function testGetAllAdditionalFileInfos()
@@ -601,10 +598,9 @@ public function testTransferDestinationAtNonExistingElement()
601598
public function testSettingMagicFile()
602599
{
603600
$this->adapter->setOptions(['magicFile' => 'test/file']);
604-
$this->assertEquals(
605-
[
606-
'bar' => ['magicFile' => 'test/file', 'ignoreNoFile' => false, 'useByteString' => true],
607-
], $this->adapter->getOptions('bar'));
601+
$this->assertEquals([
602+
'bar' => ['magicFile' => 'test/file', 'ignoreNoFile' => false, 'useByteString' => true],
603+
], $this->adapter->getOptions('bar'));
608604
}
609605

610606
/**

test/Transfer/Adapter/HttpTestMockAdapter.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,21 @@ public static function isApcAvailable()
4141

4242
public static function apcTest($id)
4343
{
44-
return ['total' => 100, 'current' => 100, 'rate' => 10];
44+
return [
45+
'total' => 100,
46+
'current' => 100,
47+
'rate' => 10,
48+
];
4549
}
4650

4751
public static function uPTest($id)
4852
{
49-
return ['bytes_total' => 100, 'bytes_uploaded' => 100, 'speed_average' => 10, 'cancel_upload' => true];
53+
return [
54+
'bytes_total' => 100,
55+
'bytes_uploaded' => 100,
56+
'speed_average' => 10,
57+
'cancel_upload' => true,
58+
];
5059
}
5160

5261
public function switchApcToUP()

0 commit comments

Comments
 (0)