summaryrefslogtreecommitdiffstats
path: root/test/ControlsTest.php
diff options
context:
space:
mode:
authorignace nyamagana butera <nyamsprod@gmail.com>2015-11-24 12:00:26 +0100
committerignace nyamagana butera <nyamsprod@gmail.com>2015-11-24 12:00:26 +0100
commitbfcc2d633a0160853684ecd0c9c82b6e3b3d32ef (patch)
tree0782a13735eac74199f11b63493f6e1808e3b2a0 /test/ControlsTest.php
parent69bafa6ff924fbf9effe4275d6eb16be81a853ef (diff)
parentc3a2ae5ccdc2ea05de734716f892d9b7f5f28774 (diff)
downloadcsv-bfcc2d633a0160853684ecd0c9c82b6e3b3d32ef.zip
csv-bfcc2d633a0160853684ecd0c9c82b6e3b3d32ef.tar.gz
csv-bfcc2d633a0160853684ecd0c9c82b6e3b3d32ef.tar.bz2
Merge pull request #137 from nyamsprod/features/improve-reader
Reader class complete rewrite
Diffstat (limited to 'test/ControlsTest.php')
-rw-r--r--test/ControlsTest.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/ControlsTest.php b/test/ControlsTest.php
index 4eebed7..f80364a 100644
--- a/test/ControlsTest.php
+++ b/test/ControlsTest.php
@@ -7,8 +7,6 @@ use League\Csv\Writer;
use SplFileObject;
use SplTempFileObject;
-date_default_timezone_set('UTC');
-
/**
* @group controls
*/
@@ -93,7 +91,7 @@ class ControlsTest extends AbstractTestCase
public function testDetectDelimiterList()
{
- $this->assertSame([4 => ','], $this->csv->detectDelimiterList());
+ $this->assertSame([',' => 4], $this->csv->fetchDelimitersOccurrence([',']));
}
/**
@@ -102,7 +100,7 @@ class ControlsTest extends AbstractTestCase
*/
public function testDetectDelimiterListWithInvalidRowLimit()
{
- $this->csv->detectDelimiterList(-4);
+ $this->csv->fetchDelimitersOccurrence([','], -4);
}
public function testDetectDelimiterListWithNoCSV()
@@ -110,7 +108,7 @@ class ControlsTest extends AbstractTestCase
$file = new SplTempFileObject();
$file->fwrite("How are you today ?\nI'm doing fine thanks!");
$csv = Writer::createFromFileObject($file);
- $this->assertSame([], $csv->detectDelimiterList(5, ['toto', '|']));
+ $this->assertSame(['|' => 0], $csv->fetchDelimitersOccurrence(['toto', '|'], 5));
}
public function testDetectDelimiterListWithInconsistentCSV()
@@ -124,7 +122,7 @@ class ControlsTest extends AbstractTestCase
$data->fputcsv(['toto', 'tata', 'tutu']);
$csv = Writer::createFromFileObject($data);
- $this->assertSame([12 => '|', 4 => ';'], $csv->detectDelimiterList(5, ['|']));
+ $this->assertSame(['|' => 12, ';' => 4], $csv->fetchDelimitersOccurrence(['|', ';'], 5));
}
/**
@@ -197,7 +195,7 @@ class ControlsTest extends AbstractTestCase
public function testAppliedFlags($flag, $line_count)
{
$path = __DIR__.'/data/tmp.txt';
- $obj = new SplFileObject($path, 'w+');
+ $obj = new SplFileObject($path, 'w+');
$obj->fwrite("1st\n2nd\n");
$reader = Reader::createFromFileObject($obj);
$reader->setFlags($flag);