summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgnace Nyamagana Butera <nyamsprod@gmail.com>2014-01-10 13:42:57 +0100
committerIgnace Nyamagana Butera <nyamsprod@gmail.com>2014-01-10 13:42:57 +0100
commit0f5361ed7e3ac945f17df0d4c511f9bc5cce00e6 (patch)
tree15f1fcba92bfd379f50c150924c24783bcb9dac0 /test
parentc3182d8498838c2e53002a68685ec301a9baa9f1 (diff)
downloadcsv-0f5361ed7e3ac945f17df0d4c511f9bc5cce00e6.zip
csv-0f5361ed7e3ac945f17df0d4c511f9bc5cce00e6.tar.gz
csv-0f5361ed7e3ac945f17df0d4c511f9bc5cce00e6.tar.bz2
Bug fix in the Reader class to allow fetchAssoc to combine array when the number of items does not match
Diffstat (limited to 'test')
-rw-r--r--test/Bakame/Csv/ReaderTest.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Bakame/Csv/ReaderTest.php b/test/Bakame/Csv/ReaderTest.php
index b061b06..8ccd49f 100644
--- a/test/Bakame/Csv/ReaderTest.php
+++ b/test/Bakame/Csv/ReaderTest.php
@@ -57,6 +57,18 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
foreach ($res as $index => $row) {
$this->assertSame($keys, array_keys($row));
}
+
+ $keys = ['firstname'];
+ $res = $this->reader->fetchAssoc($keys);
+ $this->assertSame([['firstname' => 'foo'], ['firstname' => 'foo']], $res);
+
+ $keys = ['firstname', 'lastname', 'email', 'age'];
+ $res = $this->reader->fetchAssoc($keys);
+ foreach ($res as $index => $row) {
+ $this->assertCount(4, array_values($row));
+ $this->assertNull($row['age']);
+ }
+
}
public function testFetchCol()