summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgnace Nyamagana Butera <nyamsprod@gmail.com>2015-01-28 11:08:59 +0100
committerIgnace Nyamagana Butera <nyamsprod@gmail.com>2015-01-28 11:08:59 +0100
commitd6162b8900acb6fc9416bcde0a3c8480e1d9193d (patch)
treeb6259a32790e66e3156a6f8b88ca6be61123ff10 /test
parent43191f109a77f7ddd84c52f3d057a7133affdde3 (diff)
downloadcsv-d6162b8900acb6fc9416bcde0a3c8480e1d9193d.zip
csv-d6162b8900acb6fc9416bcde0a3c8480e1d9193d.tar.gz
csv-d6162b8900acb6fc9416bcde0a3c8480e1d9193d.tar.bz2
adding Writer::setCellContentValidation
Diffstat (limited to 'test')
-rw-r--r--test/WriterTest.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/WriterTest.php b/test/WriterTest.php
index 00f152c..d4dd0ef 100644
--- a/test/WriterTest.php
+++ b/test/WriterTest.php
@@ -111,6 +111,23 @@ class WriterTest extends PHPUnit_Framework_TestCase
$this->assertSame(['john', '', 'john.doe@example.com'], $res);
}
+ public function testInsertWithoutValidation()
+ {
+ $expected = [
+ ['john', 'doe', 'john.doe@example.com'],
+ 'john,doe,john.doe@example.com',
+ ['john', null, 'john.doe@example.com'],
+ ];
+ $this->csv->setNullHandlingMode(Writer::NULL_AS_EMPTY);
+ $this->csv->setCellContentValidation(false);
+ $this->csv->insertAll($expected);
+
+ $iterator = new LimitIterator($this->csv->getIterator(), 2, 1);
+ $iterator->rewind();
+ $res = $iterator->getInnerIterator()->current();
+ $this->assertSame(['john', '', 'john.doe@example.com'], $res);
+ }
+
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage