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

Commit 12dca2f

Browse files
committed
Merge pull request #14 from buse974/cro/merge-aliases
[BUG] An alias "filerename" was requested but no service could be found ZF2.5.3
2 parents 8c9e54a + 8c7ef68 commit 12dca2f

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
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",
25+
"zendframework/zend-session": "~2.5",
2426
"fabpot/php-cs-fixer": "1.7.*",
2527
"phpunit/PHPUnit": "~4.0"
2628
},

src/Transfer/Adapter/FilterPluginManager.php

Lines changed: 16 additions & 12 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.
@@ -20,16 +21,19 @@
2021
*/
2122
class FilterPluginManager extends BaseManager
2223
{
23-
/**
24-
* Default set of filters
25-
*
26-
* @var array
27-
*/
28-
protected $aliases = [
29-
'decrypt' => 'filedecrypt',
30-
'encrypt' => 'fileencrypt',
31-
'lowercase' => 'filelowercase',
32-
'rename' => 'filerename',
33-
'uppercase' => 'fileuppercase',
34-
];
24+
25+
public function __construct($configOrContainerInstance = null, array $v3config = [])
26+
{
27+
parent::__construct($configOrContainerInstance, $v3config);
28+
29+
$this->aliases = array_merge(array(
30+
'decrypt' => File\Decrypt::class,
31+
'encrypt' => File\Encrypt::class,
32+
'lowercase' => File\LowerCase::class,
33+
'rename' => File\Rename::class,
34+
'uppercase' => File\UpperCase::class
35+
), $this->aliases);
36+
}
37+
3538
}
39+

test/Transfer/Adapter/AbstractTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function testGetFilterShouldReturnNullWhenNoMatchingIdentifierExists()
301301

302302
public function testAdapterShouldAllowPullingFiltersByFile()
303303
{
304-
$this->adapter->addFilter('Boolean', 1, 'foo');
304+
$this->adapter->addFilter('Boolean', [1], 'foo');
305305
$filters = $this->adapter->getFilters('foo');
306306
$this->assertEquals(1, count($filters));
307307
$filter = array_shift($filters);

test/Transfer/Adapter/HttpTestMockAdapter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class HttpTestMockAdapter extends Adapter\Http
2020
{
21+
static $aa = true;
22+
2123
public function __construct()
2224
{
2325
self::$callbackApc = ['ZendTest\File\Transfer\Adapter\HttpTestMockAdapter', 'apcTest'];
@@ -36,7 +38,7 @@ public function isValidParent($files = null)
3638

3739
public static function isApcAvailable()
3840
{
39-
return true;
41+
return static::$aa;
4042
}
4143

4244
public static function apcTest($id)
@@ -50,7 +52,7 @@ public static function uPTest($id)
5052
}
5153

5254
public function switchApcToUP()
53-
{
55+
{ static::$aa = false;
5456
self::$callbackApc = null;
5557
self::$callbackUploadProgress = ['ZendTest\File\Transfer\Adapter\HttpTestMockAdapter', 'uPTest'];
5658
}

0 commit comments

Comments
 (0)