Skip to content

Commit

Permalink
Updated tests + fixed PhpStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Jul 2, 2024
1 parent 5ac1548 commit fc5cb8c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Sheet/Safe/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Box\Spout\Writer\Exception\WriterNotOpenedException;
use Box\Spout\Writer\WriterInterface;
use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Contract\Pipeline\LoaderInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
Expand All @@ -24,7 +25,7 @@ public function __construct(

public function load(): \Generator
{
$line = yield;
$line = yield new EmptyResultBucket();
$headers = array_keys($line);
try {
$this->writer->addRow(
Expand All @@ -36,6 +37,7 @@ public function load(): \Generator
return;
}

/* @phpstan-ignore-next-line */
while (true) {
try {
$this->writer->addRow($this->orderColumns($headers, $line));
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/Sheet/FingersCrossed/ExcelLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ public function load(): void
'last name' => 'dupont',
],
],
new Loader($this->writer, 'Sheet1')
new Loader($this->writer)
);

$this->writer->close();

$this->assertRowWasWrittenToExcel(
/* 'vfs://test.xlsx' */ $path,
'Sheet1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ public function load(): void
'last name' => 'dupont',
],
],
new Loader($this->writer, 'Sheet1')
new Loader($this->writer)
);

$this->writer->close();

$this->assertRowWasWrittenToOpenDocument(
/* 'vfs://test.ods' */ $path,
'Sheet1',
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/Sheet/Safe/ExcelLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ public function load(): void
'last name' => 'dupont',
],
],
new Loader($this->writer, 'Sheet1')
new Loader($this->writer)
);

$this->writer->close();

$this->assertRowWasWrittenToExcel(
/* 'vfs://test.xlsx' */ $path,
'Sheet1',
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/Sheet/Safe/OpenDocumentLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ public function load(): void
'last name' => 'dupont',
],
],
new Loader($this->writer, 'Sheet1')
new Loader($this->writer)
);

$this->writer->close();

$this->assertRowWasWrittenToOpenDocument(
/* 'vfs://test.ods' */ $path,
'Sheet1',
Expand Down

0 comments on commit fc5cb8c

Please sign in to comment.