diff --git a/src/Period/LargePeriodPlainTextFormatter.php b/src/Period/LargePeriodPlainTextFormatter.php index e2d445e..d61fe20 100644 --- a/src/Period/LargePeriodPlainTextFormatter.php +++ b/src/Period/LargePeriodPlainTextFormatter.php @@ -34,7 +34,7 @@ public function format( $period = $periodList->current(); $output = $this->generateDates($period->getDateFrom(), $period->getDateTo()); if (!is_null($period->getWeekScheme())) { - $output .= $this->generateWeekscheme($period->getWeekScheme()); + $output .= PHP_EOL . $this->generateWeekscheme($period->getWeekScheme()); } return $output; @@ -103,7 +103,7 @@ protected function generateDates($date_from, $date_to) $dateTo = strtotime($dateToString); $intlDateTo = $fmt->format($dateTo); - $output_dates = 'Van ' . $intlDateFrom . ' tot ' . $intlDateTo . PHP_EOL; + $output_dates = 'Van ' . $intlDateFrom . ' tot ' . $intlDateTo; return $output_dates; } diff --git a/tests/Period/LargePeriodPlainTextFormatterTest.php b/tests/Period/LargePeriodPlainTextFormatterTest.php index f505cf4..dc436b4 100644 --- a/tests/Period/LargePeriodPlainTextFormatterTest.php +++ b/tests/Period/LargePeriodPlainTextFormatterTest.php @@ -90,4 +90,18 @@ public function testFormatsAPeriod() $this->formatter->format($periodList) ); } + + public function testFormatsAPeriodListWithoutUnnecessaryLineBreak() + { + $period_list = new CultureFeed_Cdb_Data_Calendar_PeriodList(); + $period = new CultureFeed_Cdb_Data_Calendar_Period('2020-09-20', '2020-09-21'); + $period_list->add($period); + + $expectedResult = 'Van 20 september 2020 tot 21 september 2020'; + + $this->assertEquals( + $expectedResult, + $this->formatter->format($period_list) + ); + } }