Skip to content

Commit

Permalink
Improve ReaderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 10, 2015
1 parent 66d71d9 commit 630f690
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions test/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public function testSetOffsetThrowException()
}

/**
* @param $offset
* @param $limit
* @param $expected
* @dataProvider intervalTest
*/
public function testInterval($offset, $limit, $expected)
Expand Down Expand Up @@ -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());
}

Expand All @@ -124,16 +117,7 @@ public function testFetchAll()
$this->assertContains(['JANE', 'DOE', '[email protected]'], $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);
Expand All @@ -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));
}
Expand Down

0 comments on commit 630f690

Please sign in to comment.