11<?php
22
3- namespace NFePHP \Sintegra \Tests ;
3+ namespace NFePHP \Sintegra \Tests \ Elements ;
44
5+ use NFePHP \Sintegra \Elements \Z10 ;
56use PHPUnit \Framework \TestCase ;
67
7- class Bloco1Test extends TestCase
8+ class Z10Test extends TestCase
89{
9- public function testZ10CNPJSuccess ()
10+ public function testZ10CnpjSuccess (): void
1011 {
1112 $ std = new \stdClass ();
12- $ std ->cNPJ = '77774523000110 ' ;
13+ $ std ->CNPJ = '77774523000110 ' ;
1314 $ std ->IE = null ;
1415 $ std ->NOME_CONTRIBUINTE = 'FULANO DE TAL LTDA ' ;
1516 $ std ->MUNICIPIO = 'BREJO SECO ' ;
@@ -21,18 +22,18 @@ public function testZ10CNPJSuccess()
2122 $ std ->COGIGO_NATUREZAS = '3 ' ;
2223 $ std ->COGIGO_FINALIDADE = '1 ' ;
2324
24- $ elem = new \ NFePHP \ Sintegra \ Elements \ Z10 ($ std );
25+ $ elem = new Z10 ($ std );
2526 $ got = "{$ elem }" ;
2627 $ expected = '1077774523000110 FULANO DE TAL LTDA BREJO SECO MA00000000002021010120210131131 ' ;
2728
2829 $ this ->assertEquals ($ expected , $ got );
2930 $ this ->assertEquals ($ elem ->errors , []);
3031 }
3132
32- public function testZ10CPFSuccess ()
33+ public function testZ10CpfSuccess (): void
3334 {
3435 $ std = new \stdClass ();
35- $ std ->cNPJ = '50795722052 ' ;
36+ $ std ->CNPJ = '50795722052 ' ;
3637 $ std ->IE = null ;
3738 $ std ->NOME_CONTRIBUINTE = 'FULANO DE TAL LTDA ' ;
3839 $ std ->MUNICIPIO = 'BREJO SECO ' ;
@@ -44,18 +45,18 @@ public function testZ10CPFSuccess()
4445 $ std ->COGIGO_NATUREZAS = '3 ' ;
4546 $ std ->COGIGO_FINALIDADE = '1 ' ;
4647
47- $ elem = new \ NFePHP \ Sintegra \ Elements \ Z10 ($ std );
48+ $ elem = new Z10 ($ std );
4849 $ got = "{$ elem }" ;
4950 $ expected = '1000050795722052 FULANO DE TAL LTDA BREJO SECO MA00000000002021010120210131131 ' ;
5051
5152 $ this ->assertEquals ($ expected , $ got );
5253 $ this ->assertEquals ($ elem ->errors , []);
5354 }
5455
55- public function testZ10Fail ()
56+ public function testZ10InvalidCnpj (): void
5657 {
5758 $ std = new \stdClass ();
58- $ std ->cNPJ = '777745230 ' ;
59+ $ std ->CNPJ = '777745230 ' ;
5960 $ std ->IE = null ;
6061 $ std ->NOME_CONTRIBUINTE = 'FULANO DE TAL LTDA ' ;
6162 $ std ->MUNICIPIO = 'BREJO SECO ' ;
@@ -67,7 +68,7 @@ public function testZ10Fail()
6768 $ std ->COGIGO_NATUREZAS = '3 ' ;
6869 $ std ->COGIGO_FINALIDADE = '1 ' ;
6970
70- $ elem = new \ NFePHP \ Sintegra \ Elements \ Z10 ($ std );
71+ $ elem = new Z10 ($ std );
7172 $ got = "{$ elem }" ;
7273 $ expected = '1000000777745230 FULANO DE TAL LTDA BREJO SECO MA00000000002021010120210131131 ' ;
7374 $ this ->assertEquals ($ expected , $ got );
@@ -77,44 +78,10 @@ public function testZ10Fail()
7778 $ this ->assertEquals ($ elem ->errors [1 ]->message , $ message );
7879 }
7980
80- public function testZ11Success ()
81+ public function testBuildWithAlphanumericCnpj (): void
8182 {
8283 $ std = new \stdClass ();
83- $ std ->LOGRADOURO = 'RUA DO OUVIDOR ' ;
84- $ std ->NUMERO = '100 ' ;
85- $ std ->COMPLEMENTO = null ;
86- $ std ->BAIRRO = '' ;
87- $ std ->CEP = '12345678 ' ;
88- $ std ->CONTATO = 'FULANO DE TAL ' ;
89- $ std ->TELEFONE = '5555555 ' ;
90- $ elem = new \NFePHP \Sintegra \Elements \Z11 ($ std );
91- $ got = "{$ elem }" ;
92- $ expected = '11RUA DO OUVIDOR 00100 12345678FULANO DE TAL 000005555555 ' ;
93- $ this ->assertEquals ($ expected , $ got );
94- }
95-
96- public function testZ11Fail ()
97- {
98- $ std = new \stdClass ();
99- $ std ->LOGRADOURO = 'RUA DO OUVIDOR ' ;
100- $ std ->NUMERO = '100 ' ;
101- $ std ->COMPLEMENTO = null ;
102- $ std ->BAIRRO = '' ;
103- //$std->CEP = '12345678';
104- $ std ->CONTATO = 'FULANO DE TAL ' ;
105- $ std ->TELEFONE = '5555555 ' ;
106- $ elem = new \NFePHP \Sintegra \Elements \Z11 ($ std );
107- $ got = "{$ elem }" ;
108- $ expected = '11RUA DO OUVIDOR 00100 00000000FULANO DE TAL 000005555555 ' ;
109- $ this ->assertEquals ($ expected , $ got );
110- $ this ->assertNotEmpty ($ elem ->errors );
111- }
112-
113- public function testBlocoSuccess ()
114- {
115- $ b1 = new \NFePHP \Sintegra \Blocks \Block1 ();
116- $ std = new \stdClass ();
117- $ std ->cNPJ = '77774523000110 ' ;
84+ $ std ->CNPJ = 'NLG6401C000144 ' ;
11885 $ std ->IE = null ;
11986 $ std ->NOME_CONTRIBUINTE = 'FULANO DE TAL LTDA ' ;
12087 $ std ->MUNICIPIO = 'BREJO SECO ' ;
@@ -125,23 +92,12 @@ public function testBlocoSuccess()
12592 $ std ->COGIGO_MAGNETICO = '1 ' ;
12693 $ std ->COGIGO_NATUREZAS = '3 ' ;
12794 $ std ->COGIGO_FINALIDADE = '1 ' ;
128- $ b1 ->z10 ($ std );
129-
130- $ std = new \stdClass ();
131- $ std ->LOGRADOURO = 'RUA DO OUVIDOR ' ;
132- $ std ->NUMERO = '100 ' ;
133- $ std ->COMPLEMENTO = null ;
134- $ std ->BAIRRO = '' ;
135- $ std ->CEP = '12345678 ' ;
136- $ std ->CONTATO = 'FULANO DE TAL ' ;
137- $ std ->TELEFONE = '5555555 ' ;
138- $ b1 ->z11 ($ std );
13995
140- $ bloco = $ b1 ->get ();
141-
142- $ expected = "1077774523000110 FULANO DE TAL LTDA BREJO SECO MA00000000002021010120210131131 \r\n"
143- . "11RUA DO OUVIDOR 00100 12345678FULANO DE TAL 000005555555 \r\n" ;
96+ $ elem = new Z10 ($ std );
97+ $ got = "{$ elem }" ;
98+ $ expected = '10NLG6401C000144 FULANO DE TAL LTDA BREJO SECO MA00000000002021010120210131131 ' ;
14499
145- $ this ->assertEquals ($ expected , $ bloco );
100+ $ this ->assertEquals ($ expected , $ got );
101+ $ this ->assertEquals ($ elem ->errors , []);
146102 }
147103}
0 commit comments