| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
File_CSV Test Case bug4792_part1: All lines but last end with a whitespace Part 1
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
// $Id: bug4792_part1.phpt,v 1.2 2007/05/11 21:49:01 cipri Exp $
|
|
|
6 |
/**
|
|
|
7 |
* Test for:
|
|
|
8 |
* - odd quote behaviour in discoverFormat excludes the last field
|
|
|
9 |
* When the first field is quoted and the next field is not then
|
|
|
10 |
* the last field is popped off
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
require_once 'File/CSV.php';
|
|
|
14 |
|
|
|
15 |
$file = dirname(__FILE__) . '/bug4792_part1.csv';
|
|
|
16 |
$conf = File_CSV::discoverFormat($file);
|
|
|
17 |
|
|
|
18 |
echo "Data:\n";
|
|
|
19 |
while ($row = File_CSV::read($file, $conf)) {
|
|
|
20 |
$lastColumn = $row[count($row)-1];
|
|
|
21 |
echo str_replace("\r\n","[CRLF]", $lastColumn);
|
|
|
22 |
echo ($lastColumn == trim($lastColumn)) ? '- Ends OK' : '- Ends with white space';
|
|
|
23 |
echo "\n";
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
?>
|
|
|
27 |
--EXPECT--
|
|
|
28 |
Data:
|
|
|
29 |
Email- Ends OK
|
|
|
30 |
razzar@gmail.com- Ends OK
|
|
|
31 |
email@email.com- Ends OK
|