-
-
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.
Merge pull request #406 from IonBazan/feature/test-fix
do not allow for output during tests
- Loading branch information
Showing
15 changed files
with
67 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ public function testAutoDetect(): void | |
*/ | ||
public function testColumnsCount(): void | ||
{ | ||
self::expectException(CannotInsertRecord::class); | ||
$this->expectException(CannotInsertRecord::class); | ||
$this->csv->addValidator(new ColumnConsistency(3), 'consistency'); | ||
$this->csv->insertOne(['john', 'doe', '[email protected]']); | ||
$this->csv->insertOne(['jane', '[email protected]']); | ||
|
@@ -82,7 +82,7 @@ public function testColumnsCount(): void | |
*/ | ||
public function testColumsCountTriggersException(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
new ColumnConsistency(-2); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -88,7 +88,7 @@ public function testCreateFromFileObjectPreserveFileObjectCsvControls(): void | |
*/ | ||
public function testCreateFromPathThrowsRuntimeException(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
Reader::createFromPath(__DIR__.'/foo/bar', 'r'); | ||
} | ||
|
||
|
@@ -125,7 +125,7 @@ public function bomProvider(): array | |
*/ | ||
public function testCloningIsForbidden(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
clone $this->csv; | ||
} | ||
|
||
|
@@ -136,7 +136,10 @@ public function testCloningIsForbidden(): void | |
*/ | ||
public function testOutputSize(): void | ||
{ | ||
self::assertSame(60, $this->csv->output('test.csv')); | ||
ob_start(); | ||
$length = $this->csv->output('test.csv'); | ||
ob_end_clean(); | ||
self::assertSame(60, $length); | ||
} | ||
|
||
/** | ||
|
@@ -146,7 +149,7 @@ public function testOutputSize(): void | |
*/ | ||
public function testInvalidOutputFile(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
$this->csv->output('invalid/file.csv'); | ||
} | ||
|
||
|
@@ -165,7 +168,9 @@ public function testOutputHeaders(): void | |
|
||
$raw_csv = Reader::BOM_UTF8."john,doe,[email protected]\njane,doe,[email protected]\n"; | ||
$csv = Reader::createFromString($raw_csv); | ||
ob_start(); | ||
$csv->output('tést.csv'); | ||
ob_end_clean(); | ||
$headers = xdebug_get_headers(); | ||
|
||
// Due to the variety of ways the xdebug expresses Content-Type of text files, | ||
|
@@ -203,7 +208,7 @@ public function testToString(): void | |
*/ | ||
public function testChunkTriggersException(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
$chunk = $this->csv->chunk(0); | ||
iterator_to_array($chunk); | ||
} | ||
|
@@ -235,7 +240,7 @@ public function testStreamFilterMode(): void | |
*/ | ||
public function testDelimiter(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
$this->csv->setDelimiter('o'); | ||
self::assertSame('o', $this->csv->getDelimiter()); | ||
self::assertSame($this->csv, $this->csv->setDelimiter('o')); | ||
|
@@ -286,7 +291,7 @@ public function testChangingBOMOnOutput(): void | |
*/ | ||
public function testEscape(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
$this->csv->setEscape('o'); | ||
self::assertSame('o', $this->csv->getEscape()); | ||
self::assertSame($this->csv, $this->csv->setEscape('o')); | ||
|
@@ -300,7 +305,7 @@ public function testEscape(): void | |
*/ | ||
public function testEnclosure(): void | ||
{ | ||
self::expectException(Exception::class); | ||
$this->expectException(Exception::class); | ||
$this->csv->setEnclosure('o'); | ||
self::assertSame('o', $this->csv->getEnclosure()); | ||
self::assertSame($this->csv, $this->csv->setEnclosure('o')); | ||
|
@@ -330,7 +335,7 @@ public function testAddStreamFilter(): void | |
*/ | ||
public function testFailedAddStreamFilter(): void | ||
{ | ||
self::expectException(UnavailableFeature::class); | ||
$this->expectException(UnavailableFeature::class); | ||
$csv = Writer::createFromFileObject(new SplTempFileObject()); | ||
self::assertFalse($csv->supportsStreamFilter()); | ||
$csv->addStreamFilter('string.toupper'); | ||
|
@@ -343,7 +348,7 @@ public function testFailedAddStreamFilter(): void | |
*/ | ||
public function testFailedAddStreamFilterWithWrongFilter(): void | ||
{ | ||
self::expectException(InvalidArgument::class); | ||
$this->expectException(InvalidArgument::class); | ||
/** @var resource $tmpfile */ | ||
$tmpfile = tmpfile(); | ||
$csv = Writer::createFromStream($tmpfile); | ||
|
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
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
Oops, something went wrong.