summaryrefslogtreecommitdiffstats
path: root/test/ControlsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'test/ControlsTest.php')
-rw-r--r--test/ControlsTest.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/ControlsTest.php b/test/ControlsTest.php
index 4eebed7..35f6fe8 100644
--- a/test/ControlsTest.php
+++ b/test/ControlsTest.php
@@ -1,9 +1,10 @@
<?php
-namespace League\Csv\Test;
+namespace League\Csv\test;
use League\Csv\Reader;
use League\Csv\Writer;
+use PHPUnit_Framework_TestCase;
use SplFileObject;
use SplTempFileObject;
@@ -12,7 +13,7 @@ date_default_timezone_set('UTC');
/**
* @group controls
*/
-class ControlsTest extends AbstractTestCase
+class ControlsTest extends PHPUnit_Framework_TestCase
{
private $csv;
@@ -93,7 +94,7 @@ class ControlsTest extends AbstractTestCase
public function testDetectDelimiterList()
{
- $this->assertSame([4 => ','], $this->csv->detectDelimiterList());
+ $this->assertSame([',' => 4], $this->csv->fetchDelimitersOccurrence([',']));
}
/**
@@ -102,7 +103,7 @@ class ControlsTest extends AbstractTestCase
*/
public function testDetectDelimiterListWithInvalidRowLimit()
{
- $this->csv->detectDelimiterList(-4);
+ $this->csv->fetchDelimitersOccurrence([','], -4);
}
public function testDetectDelimiterListWithNoCSV()
@@ -110,7 +111,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 +125,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));
}
/**
@@ -192,12 +193,14 @@ class ControlsTest extends AbstractTestCase
* @param $flag
* @param $line_count
* @dataProvider appliedFlagsProvider
- * @skipIfHHVM
*/
public function testAppliedFlags($flag, $line_count)
{
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('HHVM CSV parsing is different');
+ }
$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);