auto(file_get_contents($filename))); self::assertCount(4, $csv->data); self::assertCount(6, reset($csv->data)); } public function testWriteStream() { $csv = new Csv(); $csv->linefeed = "\n"; $many_dots = str_repeat('.', 1000 * 1000); $csv->data = [ [ 'Name' => 'Rudolf', 'Question' => 'Which color is his nose?', ], [ 'Name' => 'Sponge Bob', 'Question' => 'Which shape are his pants?', ], [ 'Name' => $many_dots, 'Question' => 'Can you count one million dots?', ], ]; // Just export the first column, but with a new name $csv->titles = ['Name' => 'Character']; // Write data to our stream: $filename = 'example://data'; copy(__DIR__ . '/fixtures/datatype.csv', $filename); self::assertSame(true, $csv->save($filename)); $expected = "Character\nRudolf\nSponge Bob\n"; $expected .= $many_dots . "\n"; self::assertSame($expected, file_get_contents($filename)); } }