Added PHPUnit test for sorting; I could not get the rows in the right...

order without calling array_values - maybe this helps just PHPUnit. I
consider the risk of breaking library users' code unlikely.
This commit is contained in:
Christian Bläul
2018-02-02 12:22:23 +01:00
parent 34d28f7435
commit adcd258ea2
3 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
class BaseClass extends PHPUnit\Framework\TestCase {
/**
* CSV
* The parseCSV object
*
* @access protected
* @var parseCSV
*/
protected $csv;
/**
* Setup
* Setup our test environment objects
*
* @access public
*/
public function setUp() {
$this->csv = new parseCSV();
}
protected function _compareWithExpected($expected) {
$this->csv->auto(__DIR__ . '/../../examples/_books.csv');
$actual = array_map(function ($row) {
return $row['title'];
}, $this->csv->data);
$this->assertEquals($expected, $actual);
}
}