1 | <?php |
||
22 | class CsvConfigurationTest extends TestCase |
||
23 | { |
||
24 | public function testImplementsInterface() |
||
30 | |||
31 | public function testDefaultsAreAssignedWhenNoOptionsSupplied() |
||
32 | { |
||
33 | $definition = new CsvConfiguration(); |
||
34 | |||
35 | static::assertEquals(',', $definition->getDelimiter(), "Default Delimiter should be ','"); |
||
36 | static::assertEquals('"', $definition->getQuote(), "Default quote character should be \""); |
||
37 | static::assertEquals('\\N', $definition->getNullValue(), "Null character should be '\\N'"); |
||
38 | static::assertEquals( |
||
39 | ["\n", "\r", "\r\n"], |
||
40 | $definition->getNewLines(), |
||
41 | "Line terminator should be ['\\n','\\r','\\r\\n']" |
||
42 | ); |
||
43 | static::assertEquals('\\', $definition->getEscape(), "Default escape character should be '\\'"); |
||
44 | static::assertEquals(false, $definition->useDoubleQuotes(), "Double quote should be off by default"); |
||
45 | static::assertEquals( |
||
46 | [ |
||
47 | Bom::BOM_UTF8, |
||
48 | Bom::BOM_UTF16_BE, |
||
49 | Bom::BOM_UTF16_LE, |
||
50 | Bom::BOM_UTF32_BE, |
||
51 | Bom::BOM_UTF32_LE, |
||
52 | ], |
||
53 | $definition->getBoms(), |
||
54 | "By default BOM should be set to all BOMs" |
||
55 | ); |
||
56 | static::assertEquals('UTF-8', $definition->getEncoding(), "Default encoding should be 'UTF-8'"); |
||
57 | } |
||
58 | |||
59 | public function testAssigningOptionsModifiesTheDefinition() |
||
81 | |||
82 | public function testNewLinesInTheWrongFormatWillThrowAnException() |
||
89 | |||
90 | public function testBomsInTheWrongFormatWillThrowAnException() |
||
97 | } |
||
98 |