diff options
author | Ignace Nyamagana Butera <nyamsprod@gmail.com> | 2014-01-10 13:42:57 +0100 |
---|---|---|
committer | Ignace Nyamagana Butera <nyamsprod@gmail.com> | 2014-01-10 13:42:57 +0100 |
commit | 0f5361ed7e3ac945f17df0d4c511f9bc5cce00e6 (patch) | |
tree | 15f1fcba92bfd379f50c150924c24783bcb9dac0 /test | |
parent | c3182d8498838c2e53002a68685ec301a9baa9f1 (diff) | |
download | csv-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.php | 12 |
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() |