File tree Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 10
10
use Box \Spout \Writer \Exception \WriterNotOpenedException ;
11
11
use Box \Spout \Writer \WriterInterface ;
12
12
use Kiboko \Component \Bucket \AcceptanceResultBucket ;
13
+ use Kiboko \Component \Bucket \EmptyResultBucket ;
14
+ use Kiboko \Contract \Bucket \ResultBucketInterface ;
15
+ use Kiboko \Contract \Pipeline \FlushableInterface ;
13
16
use Kiboko \Contract \Pipeline \LoaderInterface ;
14
17
use Psr \Log \LoggerInterface ;
15
18
use Psr \Log \NullLogger ;
@@ -24,7 +27,7 @@ public function __construct(
24
27
25
28
public function load (): \Generator
26
29
{
27
- $ line = yield ;
30
+ $ line = yield new EmptyResultBucket () ;
28
31
$ headers = array_keys ($ line );
29
32
try {
30
33
$ this ->writer ->addRow (
@@ -36,6 +39,7 @@ public function load(): \Generator
36
39
return ;
37
40
}
38
41
42
+ /* @phpstan-ignore-next-line */
39
43
while (true ) {
40
44
try {
41
45
$ 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
74
74
'last name ' => 'dupont ' ,
75
75
],
76
76
],
77
- new Loader ($ this ->writer , ' Sheet1 ' )
77
+ new Loader ($ this ->writer )
78
78
);
79
79
80
+ $ this ->writer ->close ();
81
+
80
82
$ this ->assertRowWasWrittenToExcel (
81
83
/* 'vfs://test.xlsx' */ $ path ,
82
84
'Sheet1 ' ,
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
74
74
'last name ' => 'dupont ' ,
75
75
],
76
76
],
77
- new Loader ($ this ->writer , ' Sheet1 ' )
77
+ new Loader ($ this ->writer )
78
78
);
79
79
80
+ $ this ->writer ->close ();
81
+
80
82
$ this ->assertRowWasWrittenToOpenDocument (
81
83
/* 'vfs://test.ods' */ $ path ,
82
84
'Sheet1 ' ,
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
74
74
'last name ' => 'dupont ' ,
75
75
],
76
76
],
77
- new Loader ($ this ->writer , ' Sheet1 ' )
77
+ new Loader ($ this ->writer )
78
78
);
79
79
80
+ $ this ->writer ->close ();
81
+
80
82
$ this ->assertRowWasWrittenToExcel (
81
83
/* 'vfs://test.xlsx' */ $ path ,
82
84
'Sheet1 ' ,
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ public function load(): void
74
74
'last name ' => 'dupont ' ,
75
75
],
76
76
],
77
- new Loader ($ this ->writer , ' Sheet1 ' )
77
+ new Loader ($ this ->writer )
78
78
);
79
79
80
+ $ this ->writer ->close ();
81
+
80
82
$ this ->assertRowWasWrittenToOpenDocument (
81
83
/* 'vfs://test.ods' */ $ path ,
82
84
'Sheet1 ' ,
You can’t perform that action at this time.
0 commit comments