Skip to content

Commit

Permalink
test: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Ernst committed Oct 17, 2023
1 parent 4da2fdc commit 75382f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/Helper/SplitStreet.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public static function splitStreet(string $fullStreet, string $local, string $de
$matches['box_separator'] = self::BOX_NL;
}

if ($matches['box_separator'] && ! $matches['box_number']) {
$matches['number_suffix'] = $matches['box_separator'];
$matches['box_separator'] = null;
}

$fullStreet = implode(
' ',
array_filter([
Expand Down
19 changes: 9 additions & 10 deletions test/Model/Consignment/ConsignmentSplitStreetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,15 @@ public function provideSplitStreetData(): array
self::expected(self::NUMBER) => '5',
self::expected(self::NUMBER_SUFFIX) => 'D',
],
// TODO: This test case is currently impossible to fix because of 'B' being both a number suffix and a box separator
// [
// self::FULL_STREET => 'Slameuterstraat 9B',
// self::COUNTRY => 'BE',
// self::CARRIER_ID => CarrierBpost::ID,
// self::expected(self::FULL_STREET) => 'Slameuterstraat 9 B',
// self::expected(self::STREET) => 'Slameuterstraat',
// self::expected(self::NUMBER) => '9',
// self::expected(self::NUMBER_SUFFIX) => 'B',
// ],
[
self::FULL_STREET => 'Slameuterstraat 9B',
self::COUNTRY => 'BE',
self::CARRIER_ID => CarrierBpost::ID,
self::expected(self::FULL_STREET) => 'Slameuterstraat 9 B',
self::expected(self::STREET) => 'Slameuterstraat',
self::expected(self::NUMBER) => '9',
self::expected(self::NUMBER_SUFFIX) => 'B',
],
[
self::FULL_STREET => 'Oud-Dorpsstraat 136 3',
self::COUNTRY => 'BE',
Expand Down

0 comments on commit 75382f2

Please sign in to comment.