From 630f69081696cbb091338086724f809472a7ee79 Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Thu, 10 Dec 2015 17:22:45 +0100 Subject: [PATCH] Improve ReaderTest --- test/ReaderTest.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 9e606e0c..7cf72beb 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -58,9 +58,6 @@ public function testSetOffsetThrowException() } /** - * @param $offset - * @param $limit - * @param $expected * @dataProvider intervalTest */ public function testInterval($offset, $limit, $expected) @@ -107,10 +104,6 @@ public function testSortBy() return strcmp($rowA[0], $rowB[0]); }; $this->csv->addSortBy($func); - $this->csv->addFilter(function ($row) { - return $row != [null]; - - }); $this->assertSame(array_reverse($this->expected), $this->csv->fetchAll()); } @@ -124,16 +117,7 @@ public function testFetchAll() $this->assertContains(['JANE', 'DOE', 'JANE.DOE@EXAMPLE.COM'], $res); } - public function testFetchAssocReturnsArray() - { - $keys = ['firstname', 'lastname', 'email']; - $res = $this->csv->fetchAssoc($keys); - foreach ($res as $offset => $row) { - $this->assertSame($keys, array_keys($row)); - } - } - - public function testFetchAssocReturnsIterator() + public function testFetchAssoc() { $keys = ['firstname', 'lastname', 'email']; $res = $this->csv->fetchAssoc($keys); @@ -145,9 +129,10 @@ public function testFetchAssocReturnsIterator() public function testFetchAssocCallback() { $keys = ['firstname', 'lastname', 'email']; - $res = $this->csv->fetchAssoc($keys, function ($value) { + $func = function ($value) { return array_map('strtoupper', $value); - }); + }; + $res = $this->csv->fetchAssoc($keys, $func); foreach ($res as $row) { $this->assertSame($keys, array_keys($row)); }