-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
82 additions
and
17 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
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 |
---|---|---|
|
@@ -120,15 +120,28 @@ public function testCloningIsForbidden() | |
/** | ||
* @runInSeparateProcess | ||
* @covers ::output | ||
* @covers ::sendHeaders | ||
*/ | ||
public function testOutputSize() | ||
{ | ||
$this->assertSame(60, $this->csv->output(__DIR__.'/data/test.csv')); | ||
$this->assertSame(60, $this->csv->output('test.csv')); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @covers ::output | ||
* @covers ::sendHeaders | ||
*/ | ||
public function testInvalidOutputFile() | ||
{ | ||
$this->expectException(Exception::class); | ||
$this->assertSame(60, $this->csv->output('invalid/file.csv')); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @covers ::output | ||
* @covers ::sendHeaders | ||
* @covers ::createFromString | ||
* @covers League\Csv\Stream | ||
*/ | ||
|
@@ -140,15 +153,15 @@ public function testOutputHeaders() | |
|
||
$raw_csv = Reader::BOM_UTF8."john,doe,[email protected]\njane,doe,[email protected]\n"; | ||
$csv = Reader::createFromString($raw_csv); | ||
$csv->output('test.csv'); | ||
$csv->output('tést.csv'); | ||
$headers = \xdebug_get_headers(); | ||
|
||
// Due to the variety of ways the xdebug expresses Content-Type of text files, | ||
// we cannot count on complete string matching. | ||
$this->assertContains('content-type: text/csv', strtolower($headers[0])); | ||
$this->assertSame($headers[1], 'Content-Transfer-Encoding: binary'); | ||
$this->assertSame($headers[2], 'Content-Description: File Transfer'); | ||
$this->assertSame($headers[3], 'Content-Disposition: attachment; filename="test.csv"'); | ||
$this->assertSame('Content-Transfer-Encoding: binary', $headers[1]); | ||
$this->assertSame('Content-Description: File Transfer', $headers[2]); | ||
$this->assertContains('Content-Disposition: attachment; filename="tst.csv"; filename*=utf-8\'\'t%C3%A9st.csv; modification-date="', $headers[3]); | ||
} | ||
|
||
/** | ||
|