diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b90c93a7..06d726e1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to ## Unreleased +* [address] define address lines according postal standards for France and Belgium (default) and change AddressRender, chill_entity_render_box and AddressRenderBox.vue + * [household] change translations (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109) * [household] add address i18n in household component (champs-libres/departement-de-la-vendee/accent-suivi-developpement#158) * [household] add on the fly i18n in household component diff --git a/phpstan-types.neon b/phpstan-types.neon index 98d17b666..949ff774a 100644 --- a/phpstan-types.neon +++ b/phpstan-types.neon @@ -315,11 +315,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php - - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" - count: 3 - path: src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index dcf0c5a96..070d40468 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -60,6 +60,8 @@ class Address /** * @var string|null * + * used for the CEDEX information + * * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue index 475558d0c..8a069298a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue @@ -2,21 +2,28 @@ -

- {{ address.text }}, -

-

- {{ address.postcode.code }} {{ address.postcode.name }} -

-

- {{ address.country.name.fr }} -

+
+

+ {{ l }} +

+
+
+

+ {{ address.text }} +

+

+ {{ address.postcode.code }} {{ address.postcode.name }} +

+

+ {{ address.country.name.fr }} +

+
-
+
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Entity/address.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Entity/address.html.twig index 4d871404f..ea8f18fc0 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Entity/address.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Entity/address.html.twig @@ -9,57 +9,23 @@ * with_delimiter bool add a delimiter between fragments * has_no_address bool * multiline bool multiline display - * extended_infos bool add extra informations (step, floor, etc.) + * extended_infos bool add extra informations (step, floor, etc.) DEPRECATED #} -{% macro raw(address, options, streetLine) %} - - {% if address.street is not empty %} -

{{ streetLine }}

- {% endif %} - {% if options['extended_infos'] %} - {{ _self.extended(address, options) }} - {% endif %} - {% if address.postCode is not empty %} -

- {{ address.postCode.code }} - {{ address.postCode.name }} -

-

{{ address.postCode.country.name|localize_translatable_string }}

- {% endif %} +{% macro raw(lines) %} + {% for l in lines %} +

{{ l }}

+ {% endfor %} {% endmacro %} -{% macro extended(address, options) %} - {% if address.floor is not empty %} - {{ 'address more.floor'|trans }} {{ address.floor }} - {% endif %} - {% if address.corridor is not empty %} - {{ 'address more.corridor'|trans }} {{ address.corridor }} - {% endif %} - {% if address.steps is not empty %} - {{ 'address more.steps'|trans }} {{ address.steps }} - {% endif %} - {% if address.buildingName is not empty %} - {{ 'address more.buildingName'|trans }} {{ address.buildingName }} - {% endif %} - {% if address.flat is not empty %} - {{ 'address more.flat'|trans }} {{ address.flat }} - {% endif %} - {% if address.extra is not empty %} - {{ 'address more.extra'|trans }} {{ address.extra }} - {% endif %} - {% if address.distribution is not empty %} - {{ 'address more.distribution'|trans }} {{ address.distribution }} - {% endif %} -{% endmacro %} - -{% macro inline(address, options, streetLine) %} +{% macro inline(address, options, streetLine, lines) %} {% if options['has_no_address'] == true and address.isNoAddress == true %} {% if address.postCode is not empty %}

{{ address.postCode.code }} {{ address.postCode.name }} + {{ address.distribution }}

{{ address.postCode.country.name|localize_translatable_string }}

{% endif %} @@ -68,7 +34,7 @@ {% else %} - {{ _self.raw(address, options, streetLine) }} + {{ _self.raw(lines) }} {% endif %} {{ _self.validity(address, options) }} @@ -97,7 +63,7 @@ {% if options['with_picto'] %} {% endif %} - {{ _self.inline(address, options, streetLine) }} + {{ _self.inline(address, options, streetLine, lines) }} {%- endif -%} @@ -106,7 +72,7 @@ {% if options['with_picto'] %} {% endif %} - {{ _self.inline(address, options, streetLine) }} + {{ _self.inline(address, options, streetLine, lines) }} {%- endif -%} @@ -118,20 +84,21 @@

{{ address.postCode.code }} {{ address.postCode.name }} + {{ address.distribution }}

{{ address.postCode.country.name|localize_translatable_string }}

-
+
{% endif %}
{{ 'address.consider homeless'|trans }}
- + {% else %}
{% if options['with_picto'] %} {% endif %} - {{ _self.raw(address, options, streetLine) }} + {{ _self.raw(lines) }}
{% endif %} {{ _self.validity(address, options) }} diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index f66eb4de6..998cb58bf 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Serializer\Normalizer; use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper; use Chill\MainBundle\Entity\Address; +use Chill\MainBundle\Templating\Entity\AddressRender; use DateTimeInterface; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; @@ -46,6 +47,13 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'validTo' => DateTimeInterface::class, ]; + private AddressRender $addressRender; + + public function __construct(AddressRender $addressRender) + { + $this->addressRender = $addressRender; + } + /** * @param Address $address * @param null|string $format @@ -53,19 +61,9 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw public function normalize($address, $format = null, array $context = []) { if ($address instanceof Address) { - $text = $address->isNoAddress() ? '' : $address->getStreet() . ', ' . $address->getStreetNumber(); - - if (null !== $address->getPostCode()->getCountry()->getCountryCode()) { - if ($address->getPostCode()->getCountry()->getCountryCode() === 'FR') { - $text = $address->isNoAddress() ? '' : $address->getStreetNumber() . ', ' . $address->getStreet(); - } else { - $text = $address->isNoAddress() ? '' : $address->getStreetNumber() . ', ' . $address->getStreet(); - } - } - $data = [ 'address_id' => $address->getId(), - 'text' => $text, + 'text' => $address->isNoAddress() ? null : $this->addressRender->renderStreetLine($address, []), 'street' => $address->getStreet(), 'streetNumber' => $address->getStreetNumber(), 'postcode' => [ @@ -85,6 +83,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'buildingName' => $address->getBuildingName(), 'distribution' => $address->getDistribution(), 'extra' => $address->getExtra(), + 'lines' => $this->addressRender->renderLines($address), ]; if ('json' === $format) { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index 1af5607c9..66d6e9e41 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Templating\Entity; use Chill\MainBundle\Entity\Address; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Symfony\Component\Templating\EngineInterface; use function array_merge; @@ -26,14 +27,18 @@ class AddressRender implements ChillEntityRenderInterface 'with_delimiter' => false, 'has_no_address' => false, 'multiline' => true, + /* deprecated */ 'extended_infos' => false, ]; private EngineInterface $templating; - public function __construct(EngineInterface $templating) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(EngineInterface $templating, TranslatableStringHelper $translatableStringHelper) { $this->templating = $templating; + $this->translatableStringHelper = $translatableStringHelper; } /** @@ -50,43 +55,49 @@ class AddressRender implements ChillEntityRenderInterface 'streetLine' => $this->renderStreetLine($addr), 'render' => $options['render'] ?? 'bloc', 'options' => $options, + 'lines' => $this->renderLines($addr), ]); } /** * @param Address addr * @param mixed $addr + * + * @return string[] */ - public function renderString($addr, array $options): string + public function renderLines($addr): array { $lines = []; - $lines[0] = $this->renderStreetLine($addr); - - if (!empty($addr->getPostcode())) { - $lines[1] = strtr('{postcode} {label}', [ - '{postcode}' => $addr->getPostcode()->getCode(), - '{label}' => $addr->getPostcode()->getName(), - ]); + if (null !== $addr->getPostCode()) { + if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') { + $lines[] = $this->renderIntraBuildingLine($addr); + $lines[] = $this->renderBuildingLine($addr); + $lines[] = $this->renderStreetLine($addr); + $lines[] = $this->renderDeliveryLine($addr); + $lines[] = $this->renderCityLine($addr); + $lines[] = $this->renderCountryLine($addr); + } else { + $lines[] = $this->renderBuildingLine($addr); + $lines[] = $this->renderDeliveryLine($addr); + $lines[] = $this->renderStreetLine($addr); + $lines[] = $this->renderCityLine($addr); + $lines[] = $this->renderCountryLine($addr); + } } - return implode(' - ', $lines); + return array_values(array_filter($lines, static fn ($l) => null !== $l)); } - public function supports($entity, array $options): bool + public function renderStreetLine(Address $addr): ?string { - return $entity instanceof Address; - } - - private function renderStreetLine($addr): string - { - if (!empty($addr->getStreet())) { + if (null !== $addr->getStreet() && $addr->getStreet() !== '') { $street = $addr->getStreet(); } else { $street = ''; } - if (!empty($addr->getStreetNumber())) { + if (null !== $addr->getStreetNumber() && $addr->getStreetNumber() !== '') { $streetNumber = $addr->getStreetNumber(); } else { $streetNumber = ''; @@ -100,8 +111,111 @@ class AddressRender implements ChillEntityRenderInterface } } - if (',' === $res) { - $res = ''; + if ((',' === $res) || ('' === $res)) { + $res = null; + } + + return $res; + } + + /** + * @param Address addr + * @param mixed $addr + */ + public function renderString($addr, array $options): string + { + return implode(' - ', $this->renderLines($addr)); + } + + public function supports($entity, array $options): bool + { + return $entity instanceof Address; + } + + private function renderBuildingLine(Address $addr): ?string + { + if (null !== $addr->getBuildingName() && $addr->getBuildingName() !== '') { + $building = $addr->getBuildingName(); + } else { + $building = ''; + } + $intraBuilding = $this->renderIntraBuildingLine($addr); + + if (null === $intraBuilding) { + $intraBuilding = ''; + } + + $res = trim($building . ' - ' . $intraBuilding, ' - '); + + if ('' === $res) { + $res = null; + } + + if (null !== $addr->getPostCode()->getCountry()->getCountryCode()) { + if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') { + $res = $addr->getBuildingName(); + } + } + + return $res; + } + + private function renderCityLine($addr): string + { + if (null !== $addr->getPostcode()) { + $res = strtr('{postcode} {label}', [ + '{postcode}' => $addr->getPostcode()->getCode(), + '{label}' => $addr->getPostcode()->getName(), + ]); + + if (null !== $addr->getPostCode()->getCountry()->getCountryCode()) { + if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') { + if ($addr->getDistribution()) { + $res = $res . ' ' . $addr->getDistribution(); + } + } + } + } + + return $res ?? ''; + } + + private function renderCountryLine($addr): ?string + { + return $this->translatableStringHelper->localize( + $addr->getPostCode()->getCountry()->getName() + ); + } + + private function renderDeliveryLine($addr): ?string + { + return $addr->getExtra(); + } + + private function renderIntraBuildingLine($addr): ?string + { + $arr = []; + + if ($addr->getFlat()) { + $arr[] = 'appart ' . $addr->getFlat(); + } + + if ($addr->getFloor()) { + $arr[] = 'ét ' . $addr->getFloor(); + } + + if ($addr->getCorridor()) { + $arr[] = 'coul ' . $addr->getCorridor(); + } + + if ($addr->getSteps()) { + $arr[] = 'esc ' . $addr->getSteps(); + } + + $res = implode(' - ', $arr); + + if ('' === $res) { + $res = null; } return $res; diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php index e577028ca..fcd7b374a 100644 --- a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Country; use Chill\MainBundle\Entity\PostalCode; use Chill\MainBundle\Templating\Entity\AddressRender; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Iterator; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Templating\EngineInterface; @@ -30,11 +31,11 @@ final class AddressRenderTest extends KernelTestCase self::bootKernel(); } - public function addressDataProvider(): Iterator + public function addressDataProviderBEWithBuilding(): Iterator { $addr = new Address(); $country = (new Country()) - ->setName(['fr' => 'Pays']) + ->setName(['fr' => 'Belgium']) ->setCountryCode('BE'); $postCode = new PostalCode(); $postCode->setName('Locality') @@ -45,20 +46,279 @@ final class AddressRenderTest extends KernelTestCase ->setStreetNumber('5') ->setPostcode($postCode); - yield [$addr, 'Rue ABC, 5 - 012345 Locality']; + $addr->setBuildingName('Résidence "Les Bleuets"'); + + yield [$addr, 'Résidence "Les Bleuets" - Rue ABC, 5 - 012345 Locality - Belgium']; + } + + public function addressDataProviderBEWithSteps(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'Belgium']) + ->setCountryCode('BE'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + $addr->setSteps('4'); + + yield [$addr, 'esc 4 - Rue ABC, 5 - 012345 Locality - Belgium']; + } + + public function addressDataProviderFRWithBuilding(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'France']) + ->setCountryCode('FR'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + $addr->setBuildingName('Résidence "Les Bleuets"'); + + yield [$addr, 'Résidence "Les Bleuets" - 5, Rue ABC - 012345 Locality - France']; + } + + public function addressDataProviderFRWithSteps(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'France']) + ->setCountryCode('FR'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + $addr->setSteps('4'); + + yield [$addr, 'esc 4 - 5, Rue ABC - 012345 Locality - France']; + } + + public function complexAddressDataProviderBE(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'Belgium']) + ->setCountryCode('BE'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + $addr->setBuildingName('Résidence "Les Bleuets"'); + $addr->setFlat('1'); + $addr->setFloor('2'); + $addr->setCorridor('3'); + $addr->setSteps('4'); + + yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 - Rue ABC, 5 - 012345 Locality - Belgium']; + } + + public function complexAddressDataProviderFR(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'France']) + ->setCountryCode('FR'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + $addr->setBuildingName('Résidence "Les Bleuets"'); + $addr->setFlat('1'); + $addr->setFloor('2'); + $addr->setCorridor('3'); + $addr->setSteps('4'); + $addr->setExtra('A droite de la porte'); + $addr->setDistribution('CEDEX'); + + yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 - Résidence "Les Bleuets" - 5, Rue ABC - A droite de la porte - 012345 Locality CEDEX - France']; + } + + public function noFullAddressDataProviderBE(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'Belgium']) + ->setCountryCode('BE'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setPostcode($postCode) + ->setIsNoAddress(true); + + yield [$addr, '012345 Locality - Belgium']; + } + + public function simpleAddressDataProviderBE(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'Belgium']) + ->setCountryCode('BE'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + yield [$addr, 'Rue ABC, 5 - 012345 Locality - Belgium']; + } + + public function simpleAddressDataProviderFR(): Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName(['fr' => 'France']) + ->setCountryCode('FR'); + $postCode = new PostalCode(); + $postCode->setName('Locality') + ->setCode('012345') + ->setCountry($country); + + $addr->setStreet('Rue ABC') + ->setStreetNumber('5') + ->setPostcode($postCode); + + yield [$addr, '5, Rue ABC - 012345 Locality - France']; } /** - * @dataProvider addressDataProvider + * @dataProvider complexAddressDataProviderBE */ - public function testRenderString(Address $addr, string $expectedString): void + public function testRenderComplexAddressBE(Address $addr, string $expectedString): void { $engine = self::$container->get(EngineInterface::class); - $renderer = new AddressRender($engine); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } - return; - $this->assertIsString($renderer->renderBox($addr, [])); + /** + * @dataProvider complexAddressDataProviderFR + */ + public function testRenderComplexAddressFR(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider noFullAddressDataProviderBE + */ + public function testRenderNoFullAddressBE(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider simpleAddressDataProviderBE + */ + public function testRenderStringSimpleAddressBE(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider simpleAddressDataProviderFR + */ + public function testRenderStringSimpleAddressFR(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider addressDataProviderBEWithBuilding + */ + public function testRenderWithBuildingAddressBE(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider addressDataProviderFRWithBuilding + */ + public function testRenderWithBuildingAddressFR(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider addressDataProviderBEWithSteps + */ + public function testRenderWithStepsAddressBE(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + } + + /** + * @dataProvider addressDataProviderFRWithSteps + */ + public function testRenderWithStepsAddressFR(Address $addr, string $expectedString): void + { + $engine = self::$container->get(EngineInterface::class); + $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); + $renderer = new AddressRender($engine, $translatableStringHelper); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); } }