Skip to content

Commit 1e71b2b

Browse files
committed
test(xml): cover tomador optional address phone and email
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent c5a53ee commit 1e71b2b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/Unit/Xml/XmlBuilderTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,26 @@ public function testTomadorCpfBlockIsIncludedWhenDocumentHas11Digits(): void
183183
self::assertSame('12345678901', $nodes->item(0)->textContent);
184184
}
185185

186+
public function testTomadorAddressPhoneAndEmailAreIncludedWhenProvided(): void
187+
{
188+
$dps = $this->makeDps(
189+
documentoTomador: '12345678000195',
190+
nomeTomador: 'Empresa Tomadora S.A.',
191+
tomadorCodigoMunicipio: '3303302',
192+
tomadorCep: '24020077',
193+
tomadorLogradouro: 'Avenida Rio Branco',
194+
tomadorTelefone: '21988887777',
195+
tomadorEmail: 'financeiro@example.test',
196+
);
197+
198+
$xml = $this->builder->buildDps($dps);
199+
200+
self::assertStringContainsString('<toma>', $xml);
201+
self::assertStringContainsString('<end><endNac><cMun>3303302</cMun><CEP>24020077</CEP></endNac><xLgr>Avenida Rio Branco</xLgr></end>', str_replace(["\n", ' '], '', $xml));
202+
self::assertStringContainsString('<fone>21988887777</fone>', $xml);
203+
self::assertStringContainsString('<email>financeiro@example.test</email>', $xml);
204+
}
205+
186206
public function testTomadorBlockIsAbsentWhenDocumentoTomadorIsEmpty(): void
187207
{
188208
$dps = $this->makeDps(documentoTomador: '');
@@ -350,6 +370,15 @@ private function makeDps(
350370
bool $issRetido = false,
351371
string $documentoTomador = '',
352372
string $nomeTomador = '',
373+
string $tomadorCodigoMunicipio = '',
374+
string $tomadorCep = '',
375+
string $tomadorLogradouro = '',
376+
string $tomadorNumero = '',
377+
string $tomadorComplemento = '',
378+
string $tomadorBairro = '',
379+
string $tomadorInscricaoMunicipal = '',
380+
string $tomadorTelefone = '',
381+
string $tomadorEmail = '',
353382
int $regimeEspecialTributacao = 0,
354383
int $tipoRetencaoIss = 1,
355384
int $opcaoSimplesNacional = 1,
@@ -380,6 +409,15 @@ private function makeDps(
380409
codigoTributacaoNacional: $codigoTributacaoNacional,
381410
documentoTomador: $documentoTomador,
382411
nomeTomador: $nomeTomador,
412+
tomadorCodigoMunicipio: $tomadorCodigoMunicipio,
413+
tomadorCep: $tomadorCep,
414+
tomadorLogradouro: $tomadorLogradouro,
415+
tomadorNumero: $tomadorNumero,
416+
tomadorComplemento: $tomadorComplemento,
417+
tomadorBairro: $tomadorBairro,
418+
tomadorInscricaoMunicipal: $tomadorInscricaoMunicipal,
419+
tomadorTelefone: $tomadorTelefone,
420+
tomadorEmail: $tomadorEmail,
383421
regimeEspecialTributacao: $regimeEspecialTributacao,
384422
tipoRetencaoIss: $tipoRetencaoIss,
385423
issRetido: $issRetido,

0 commit comments

Comments
 (0)