diff options
author | ignace nyamagana butera <nyamsprod@gmail.com> | 2014-08-24 22:22:47 +0200 |
---|---|---|
committer | ignace nyamagana butera <nyamsprod@gmail.com> | 2014-08-24 22:39:23 +0200 |
commit | cf54169cc25fccdca20dd5945b5e6f13e7d12d22 (patch) | |
tree | fb9aab50b83e2b7c63637868391ad888f3e83d86 /test | |
parent | 9dfd08b2aa2c2243b4c03efcb92867948af69f4a (diff) | |
download | csv-cf54169cc25fccdca20dd5945b5e6f13e7d12d22.zip csv-cf54169cc25fccdca20dd5945b5e6f13e7d12d22.tar.gz csv-cf54169cc25fccdca20dd5945b5e6f13e7d12d22.tar.bz2 |
remove deprecated methods
Diffstat (limited to 'test')
-rw-r--r-- | test/CsvTest.php | 26 | ||||
-rw-r--r-- | test/ReaderTest.php | 10 | ||||
-rw-r--r-- | test/WriterTest.php | 2 |
3 files changed, 17 insertions, 21 deletions
diff --git a/test/CsvTest.php b/test/CsvTest.php index c912a18..4934211 100644 --- a/test/CsvTest.php +++ b/test/CsvTest.php @@ -100,33 +100,29 @@ class CsvTest extends PHPUnit_Framework_TestCase $this->csv->setDelimiter('foo'); } - public function testDetectDelimiter() + public function testDetectDelimiterList() { - $this->assertSame($this->csv->detectDelimiter(), ','); + $this->assertSame([','], $this->csv->detectDelimiterList()); } /** * @expectedException InvalidArgumentException * @expectedExceptionMessage `$nb_rows` must be a valid positive integer */ - public function testDetectDelimiterWithInvalidRowLimit() + public function testDetectDelimiterListWithInvalidRowLimit() { - $this->csv->detectDelimiter(-4); + $this->csv->detectDelimiterList(-4); } - public function testDetectDelimiterWithNoCSV() + public function testDetectDelimiterListWithNoCSV() { $file = new SplTempFileObject; $file->fwrite("How are you today ?\nI'm doing fine thanks!"); $csv = Writer::createFromFileObject($file); - $this->assertNull($csv->detectDelimiter(5, ['toto', '|'])); + $this->assertSame([], $csv->detectDelimiterList(5, ['toto', '|'])); } - /** - * @expectedException RuntimeException - * @expectedExceptionMessage 'too many delimiters were found: `;`,`|`' - */ - public function testDetectDelimiterWithInconsistentCSV() + public function testDetectDelimiterListWithInconsistentCSV() { $data = new SplTempFileObject; $data->setCsvControl(';'); @@ -137,7 +133,7 @@ class CsvTest extends PHPUnit_Framework_TestCase $data->fputcsv(['toto', 'tata', 'tutu']); $csv = Writer::createFromFileObject($data); - $csv->detectDelimiter(5, ['|']); + $this->assertSame(['|', ';'], $csv->detectDelimiterList(5, ['|'])); } /** @@ -180,10 +176,10 @@ class CsvTest extends PHPUnit_Framework_TestCase public function testEncoding() { $expected = 'iso-8859-15'; - $this->csv->setEncoding($expected); - $this->assertSame(strtoupper($expected), $this->csv->getEncoding()); + $this->csv->setEncodingFrom($expected); + $this->assertSame(strtoupper($expected), $this->csv->getEncodingFrom()); - $this->csv->setEncoding(''); + $this->csv->setEncodingFrom(''); } public function testToString() diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 7773d6e..f18324c 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -71,7 +71,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase $func = function ($row) { return ! in_array('jane', $row); }; - $this->csv->setFilter($func); + $this->csv->addFilter($func); $this->assertCount(1, $this->csv->fetchAll()); @@ -97,7 +97,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase $func = function ($rowA, $rowB) { return strcmp($rowA[0], $rowB[0]); }; - $this->csv->setSortBy($func); + $this->csv->addSortBy($func); $this->assertSame(array_reverse($this->expected), $this->csv->fetchAll()); $this->csv->addSortBy($func); @@ -114,7 +114,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase $func = function ($rowA, $rowB) { return strcmp($rowA[0], $rowB[0]); }; - $csv->setSortBy($func); + $csv->addSortBy($func); $this->assertSame([ ['john', 'doe', 'john.doe@example.com'], ['john', 'doe', 'john.doe@example.com'] @@ -182,7 +182,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase public function testFetchCol() { - $this->assertSame(['john', 'jane'], $this->csv->fetchCol(0)); + $this->assertSame(['john', 'jane'], $this->csv->fetchColumn(0)); $this->assertSame(['john', 'jane'], $this->csv->fetchColumn()); } @@ -283,7 +283,7 @@ EOF; public function testGetWriter2() { - $csv = Reader::createFromPath(__DIR__.'/foo.csv')->getWriter('a+'); + $csv = Reader::createFromPath(__DIR__.'/foo.csv')->newWriter('a+'); $this->assertInstanceOf('\League\Csv\Writer', $csv); } } diff --git a/test/WriterTest.php b/test/WriterTest.php index 7b514c6..aedee30 100644 --- a/test/WriterTest.php +++ b/test/WriterTest.php @@ -214,7 +214,7 @@ class WriterTest extends PHPUnit_Framework_TestCase $this->csv->insertOne($row); } - $reader = $this->csv->getReader(); + $reader = $this->csv->newReader(); $this->assertSame(['john', 'doe', 'john.doe@example.com'], $reader->fetchOne(0)); } } |