|
@@ 56-62 (lines=7) @@
|
| 53 |
|
/** |
| 54 |
|
* @throws ParseException|\Exception |
| 55 |
|
*/ |
| 56 |
|
public function testRemovesComments(): void |
| 57 |
|
{ |
| 58 |
|
$zone = self::readFile(__DIR__.'/Resources/testClearComments_sample.txt'); |
| 59 |
|
$expectation = self::readFile(__DIR__.'/Resources/testClearComments_expectation.txt'); |
| 60 |
|
|
| 61 |
|
$this->assertEquals($expectation, Normaliser::normalise($zone)); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
/** |
| 65 |
|
* Multi-line records collapse onto single line. |
|
@@ 69-75 (lines=7) @@
|
| 66 |
|
* |
| 67 |
|
* @throws ParseException|\Exception |
| 68 |
|
*/ |
| 69 |
|
public function testMultilineRecordsCollapseOntoSingleLine(): void |
| 70 |
|
{ |
| 71 |
|
$zone = self::readFile(__DIR__.'/Resources/testCollapseMultilines_sample.txt'); |
| 72 |
|
$expectation = self::readFile(__DIR__.'/Resources/testCollapseMultilines_expectation.txt'); |
| 73 |
|
|
| 74 |
|
$this->assertEquals($expectation, Normaliser::normalise($zone)); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* Unbalanced brackets cause ParseException. |
|
@@ 120-127 (lines=8) @@
|
| 117 |
|
/** |
| 118 |
|
* @throws \Exception |
| 119 |
|
*/ |
| 120 |
|
public function testCommentsAreRetained(): void |
| 121 |
|
{ |
| 122 |
|
$zone = self::readFile(__DIR__.'/Resources/testClearComments_sample.txt'); |
| 123 |
|
$expectation = self::readFile(__DIR__.'/Resources/testKeepComments_expectation.txt'); |
| 124 |
|
$normalisedZone = Normaliser::normalise($zone, Comments::END_OF_ENTRY); |
| 125 |
|
|
| 126 |
|
$this->assertEquals($expectation, $normalisedZone); |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
/** |
| 130 |
|
* @throws \Exception |
|
@@ 144-151 (lines=8) @@
|
| 141 |
|
/** |
| 142 |
|
* @throws \Exception |
| 143 |
|
*/ |
| 144 |
|
public function testMultilineTxtRecords(): void |
| 145 |
|
{ |
| 146 |
|
$zone = self::readFile(__DIR__.'/Resources/testMultilineTxtRecords_sample.txt'); |
| 147 |
|
$expectation = self::readFile(__DIR__.'/Resources/testMultilineTxtRecords_expectation.txt'); |
| 148 |
|
$normalisedZone = Normaliser::normalise($zone, Comments::END_OF_ENTRY); |
| 149 |
|
|
| 150 |
|
$this->assertEquals($expectation, $normalisedZone); |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
/** |
| 154 |
|
* @throws \Exception |
|
@@ 156-163 (lines=8) @@
|
| 153 |
|
/** |
| 154 |
|
* @throws \Exception |
| 155 |
|
*/ |
| 156 |
|
public function testKeepCommentsWithoutLinefeedAtEnd(): void |
| 157 |
|
{ |
| 158 |
|
$zone = self::readFile(__DIR__.'/Resources/testKeepCommentsWithoutLinefeedAtEnd_sample.txt'); |
| 159 |
|
$expectation = self::readFile(__DIR__.'/Resources/testKeepCommentsWithoutLinefeedAtEnd_expectation.txt'); |
| 160 |
|
$normalisedZone = Normaliser::normalise($zone, Comments::END_OF_ENTRY); |
| 161 |
|
|
| 162 |
|
$this->assertEquals($expectation, $normalisedZone); |
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
/** |
| 166 |
|
* @throws \Exception |