summaryrefslogtreecommitdiffstats
path: root/test/StreamFilterTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'test/StreamFilterTest.php')
-rw-r--r--test/StreamFilterTest.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/StreamFilterTest.php b/test/StreamFilterTest.php
index 56862ed..ead990a 100644
--- a/test/StreamFilterTest.php
+++ b/test/StreamFilterTest.php
@@ -13,19 +13,30 @@ use SplTempFileObject;
*/
class StreamFilterTest extends PHPUnit_Framework_TestCase
{
- public function testInitStreamFilter()
+ public function testInitStreamFilterWithWriterStream()
{
$filter = 'php://filter/write=string.rot13/resource='.__DIR__.'/foo.csv';
$csv = Reader::createFromPath($filter);
$this->assertTrue($csv->hasStreamFilter('string.rot13'));
$this->assertSame(STREAM_FILTER_WRITE, $csv->getStreamFilterMode());
+ }
+ public function testInitStreamFilterWithReaderStream()
+ {
$filter = 'php://filter/read=string.toupper/resource='.__DIR__.'/foo.csv';
$csv = Reader::createFromPath($filter);
$this->assertTrue($csv->hasStreamFilter('string.toupper'));
$this->assertSame(STREAM_FILTER_READ, $csv->getStreamFilterMode());
}
+ public function testInitStreamFilterWithBothStream()
+ {
+ $filter = 'php://filter/string.toupper/resource='.__DIR__.'/foo.csv';
+ $csv = Reader::createFromPath($filter);
+ $this->assertTrue($csv->hasStreamFilter('string.toupper'));
+ $this->assertSame(STREAM_FILTER_ALL, $csv->getStreamFilterMode());
+ }
+
/**
* @expectedException LogicException
*/
@@ -101,4 +112,12 @@ class StreamFilterTest extends PHPUnit_Framework_TestCase
$csv->prependStreamFilter('string.toupper');
$this->assertFalse($csv->getIterator()->getRealPath());
}
+
+
+ public function testGetFilterPathWithAllStream()
+ {
+ $filter = 'php://filter/string.toupper/resource='.__DIR__.'/foo.csv';
+ $csv = Reader::createFromPath($filter);
+ $this->assertFalse($csv->getIterator()->getRealPath());
+ }
}