Skip to content

Commit

Permalink
setFlushThreshold method fix (#290)
Browse files Browse the repository at this point in the history
setFlushThreshold method fix (#290)
  • Loading branch information
kboduch authored and nyamsprod committed Mar 26, 2018
1 parent fa94758 commit b9a4d39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function setFlushThreshold($threshold): self
throw new TypeError(sprintf(__METHOD__.'() expects 1 Argument to be null or an integer %s given', gettype($threshold)));
}

if (null !== $threshold && 1 >= $threshold) {
if (null !== $threshold && 1 > $threshold) {
throw new Exception(__METHOD__.'() expects 1 Argument to be null or a valid integer greater or equal to 1');
}

Expand Down
11 changes: 9 additions & 2 deletions tests/WriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,17 @@ public function tearDown()
*/
public function testflushThreshold()
{
$this->expectException(Exception::class);
$this->csv->setFlushThreshold(12);
$this->assertSame(12, $this->csv->getFlushThreshold());
$this->csv->setFlushThreshold(12);
}

/**
* @covers ::setFlushThreshold
*/
public function testflushThresholdThrowsException()
{
$this->csv->setFlushThreshold(1);
$this->expectException(Exception::class);
$this->csv->setFlushThreshold(0);
}

Expand Down

0 comments on commit b9a4d39

Please sign in to comment.