File tree Expand file tree Collapse file tree 5 files changed +15
-5
lines changed
Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1010use Box \Spout \Writer \Exception \WriterNotOpenedException ;
1111use Box \Spout \Writer \WriterInterface ;
1212use Kiboko \Component \Bucket \AcceptanceResultBucket ;
13+ use Kiboko \Component \Bucket \EmptyResultBucket ;
1314use Kiboko \Contract \Pipeline \LoaderInterface ;
1415use Psr \Log \LoggerInterface ;
1516use Psr \Log \NullLogger ;
@@ -24,7 +25,7 @@ public function __construct(
2425
2526 public function load (): \Generator
2627 {
27- $ line = yield ;
28+ $ line = yield new EmptyResultBucket () ;
2829 $ headers = array_keys ($ line );
2930 try {
3031 $ this ->writer ->addRow (
@@ -36,6 +37,7 @@ public function load(): \Generator
3637 return ;
3738 }
3839
40+ /* @phpstan-ignore-next-line */
3941 while (true ) {
4042 try {
4143 $ this ->writer ->addRow ($ this ->orderColumns ($ headers , $ line ));
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
7474 'last name ' => 'dupont ' ,
7575 ],
7676 ],
77- new Loader ($ this ->writer , ' Sheet1 ' )
77+ new Loader ($ this ->writer )
7878 );
7979
80+ $ this ->writer ->close ();
81+
8082 $ this ->assertRowWasWrittenToExcel (
8183 /* 'vfs://test.xlsx' */ $ path ,
8284 'Sheet1 ' ,
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
7474 'last name ' => 'dupont ' ,
7575 ],
7676 ],
77- new Loader ($ this ->writer , ' Sheet1 ' )
77+ new Loader ($ this ->writer )
7878 );
7979
80+ $ this ->writer ->close ();
81+
8082 $ this ->assertRowWasWrittenToOpenDocument (
8183 /* 'vfs://test.ods' */ $ path ,
8284 'Sheet1 ' ,
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
7474 'last name ' => 'dupont ' ,
7575 ],
7676 ],
77- new Loader ($ this ->writer , ' Sheet1 ' )
77+ new Loader ($ this ->writer )
7878 );
7979
80+ $ this ->writer ->close ();
81+
8082 $ this ->assertRowWasWrittenToExcel (
8183 /* 'vfs://test.xlsx' */ $ path ,
8284 'Sheet1 ' ,
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
7474 'last name ' => 'dupont ' ,
7575 ],
7676 ],
77- new Loader ($ this ->writer , ' Sheet1 ' )
77+ new Loader ($ this ->writer )
7878 );
7979
80+ $ this ->writer ->close ();
81+
8082 $ this ->assertRowWasWrittenToOpenDocument (
8183 /* 'vfs://test.ods' */ $ path ,
8284 'Sheet1 ' ,
You can’t perform that action at this time.
0 commit comments