-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bug fix #213 and #208 - Remove the @deprecate message from the Reader class #208 - Bug fix internal Reader::getRow when used with a StreamIterator #213 - Bug fix StreamIterator::fputcsv
- Loading branch information
Showing
7 changed files
with
49 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use League\Csv\Reader; | ||
use League\Csv\Writer; | ||
use PHPUnit_Framework_TestCase; | ||
use SplFileObject; | ||
|
||
/** | ||
* @group stream | ||
|
@@ -117,18 +118,25 @@ public function testGetReader() | |
{ | ||
$fp = fopen('php://temp', 'r+'); | ||
$csv = Writer::createFromStream($fp); | ||
|
||
$expected = [ | ||
['john', 'doe', 'john.doe@example.com'], | ||
'john,doe,john.doe@example.com', | ||
['john', 'doe', 'john.doe@e"xample.com'], | ||
'john,doe,john.doe@e"xample.com', | ||
]; | ||
|
||
foreach ($expected as $row) { | ||
$csv->insertOne($row); | ||
} | ||
|
||
$reader = $csv->newReader(); | ||
$this->assertSame(['john', 'doe', '[email protected]'], $reader->fetchOne(0)); | ||
$this->assertSame(['john', 'doe', 'john.doe@e"xample.com'], $reader->fetchOne(0)); | ||
} | ||
|
||
public function testInsertNormalFile() | ||
{ | ||
$csv = new StreamIterator(fopen(__DIR__.'/data/foo.csv', 'a+')); | ||
$csv->fputcsv(['jane', 'doe', '[email protected]']); | ||
$csv->setFlags(SplFileObject::READ_CSV); | ||
$this->assertContains(['jane', 'doe', '[email protected]'], $csv); | ||
} | ||
|
||
public function testToString() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1st | ||
2nd |