@@ 41-59 (lines=19) @@ | ||
38 | ->andReturnNull(); |
|
39 | } |
|
40 | ||
41 | public function testInsertArray() |
|
42 | { |
|
43 | $data = [ |
|
44 | ['a', 'b', 'c', 'd'], |
|
45 | ['e', 'f', 'g', 'h'], |
|
46 | ]; |
|
47 | ||
48 | $writer = new StreamWriter($this->stream, new CsvFormatter(new CsvFormat())); |
|
49 | ||
50 | $writer->insertAll($data); |
|
51 | ||
52 | $expected = <<<CSV |
|
53 | "a","b","c","d" |
|
54 | "e","f","g","h" |
|
55 | CSV; |
|
56 | ||
57 | $this->stream->rewind(); |
|
58 | static::assertEquals($expected, $this->stream->getContents()); |
|
59 | } |
|
60 | ||
61 | public function testInsertIterator() |
|
62 | { |
|
@@ 61-79 (lines=19) @@ | ||
58 | static::assertEquals($expected, $this->stream->getContents()); |
|
59 | } |
|
60 | ||
61 | public function testInsertIterator() |
|
62 | { |
|
63 | $data = new ArrayIterator([ |
|
64 | ['a', 'b', 'c', 'd'], |
|
65 | ['e', 'f', 'g', 'h'], |
|
66 | ]); |
|
67 | ||
68 | $writer = new StreamWriter($this->stream, new CsvFormatter(new CsvFormat())); |
|
69 | ||
70 | $writer->insertAll($data); |
|
71 | ||
72 | $expected = <<<CSV |
|
73 | "a","b","c","d" |
|
74 | "e","f","g","h" |
|
75 | CSV; |
|
76 | ||
77 | $this->stream->rewind(); |
|
78 | static::assertEquals($expected, $this->stream->getContents()); |
|
79 | } |
|
80 | ||
81 | public function testInsertRow() |
|
82 | { |
|
@@ 81-95 (lines=15) @@ | ||
78 | static::assertEquals($expected, $this->stream->getContents()); |
|
79 | } |
|
80 | ||
81 | public function testInsertRow() |
|
82 | { |
|
83 | $writer = new StreamWriter($this->stream, new CsvFormatter(new CsvFormat())); |
|
84 | ||
85 | $writer->insertOne(['a', 'b', 'c', 'd']); |
|
86 | $writer->insertOne(['e', 'f', 'g', 'h']); |
|
87 | ||
88 | $expected = <<<CSV |
|
89 | "a","b","c","d" |
|
90 | "e","f","g","h" |
|
91 | CSV; |
|
92 | ||
93 | $this->stream->rewind(); |
|
94 | static::assertEquals($expected, $this->stream->getContents()); |
|
95 | } |
|
96 | ||
97 | public function testFormatterBlocks() |
|
98 | { |