Permalink
Browse files

Merge commit 'refs/pull/3486/head' of github.com:zendframework/zf2 in…

…to hotfix/decompress-filter
  • Loading branch information...
2 parents e2045fc + 545add4 commit dfd062668102ecf52073f86ba07b750b028e8ef2 @Maks3w Maks3w committed Jan 19, 2013
Showing with 28 additions and 1 deletion.
  1. +14 −1 library/Zend/Filter/Decompress.php
  2. +14 −0 tests/ZendTest/Filter/DecompressTest.php
@@ -19,7 +19,7 @@
class Decompress extends Compress
{
/**
- * Defined by Zend_Filter_Filter
+ * Use filter as functor
*
* Decompresses the content $value with the defined settings
*
@@ -30,4 +30,17 @@ public function __invoke($value)
{
return $this->getAdapter()->decompress($value);
}
+
+ /**
+ * Defined by FilterInterface
+ *
+ * Decompresses the content $value with the defined settings
+ *
+ * @param string $value Content to decompress
+ * @return string The decompressed content
+ */
+ public function filter($value)
+ {
+ return $this->getAdapter()->decompress($value);
+ }
}
@@ -97,4 +97,18 @@ public function testDecompressArchive()
$content2 = $filter2($archive);
$this->assertEquals('compress me', $content2);
}
+
+ public function testFilterMethodProxiesToDecompress()
+ {
+ $filter = new DecompressFilter('bz2');
+ $archive = __DIR__ . '/../_files/compressed.bz2';
+ $filter->setArchive($archive);
+
+ $content = $filter->compress('compress me');
+ $this->assertTrue($content);
+
+ $filter2 = new DecompressFilter('bz2');
+ $content2 = $filter2->filter($archive);
+ $this->assertEquals('compress me', $content2);
+ }
}

0 comments on commit dfd0626

Please sign in to comment.