repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CreateComprobantePagos40CaseTest.php
tests/CfdiUtilsTests/CreateComprobantePagos40CaseTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Certificado\Certificado; use CfdiUtils\CfdiCreator40; use CfdiUtils\Elements\Pagos20\Pagos; use CfdiUtils\SumasPagos20\PagosWriter; use CfdiUtils\Utils\Format; final class CreateComprobantePagos40CaseTest extends TestCase { public function testCreateComprobantePagos(): void { $cerfile = $this->utilAsset('certs/EKU9003173C9.cer'); $keyfile = $this->utilAsset('certs/EKU9003173C9.key.pem'); $certificado = new Certificado($cerfile); $fecha = strtotime('2023-06-13 14:15:16'); $fechaPago = strtotime('2023-06-12 17:18:19'); $creator = new CfdiCreator40(); $comprobante = $creator->comprobante(); $comprobante->addAttributes([ 'Fecha' => Format::datetime($fecha), 'TipoDeComprobante' => 'P', // pago 'LugarExpedicion' => '52000', 'Moneda' => 'XXX', 'Exportacion' => '01', ]); $creator->putCertificado($certificado); $comprobante->addEmisor([ 'RegimenFiscal' => '601', ]); $comprobante->addReceptor([ 'Rfc' => 'COSC8001137NA', 'Nombre' => 'CARLOS CORTES SOTO', 'RegimenFiscalReceptor' => '605', 'UsoCFDI' => 'CP01', 'DomicilioFiscalReceptor' => '52000', ]); // The concepto *must* have this content $comprobante->addConcepto([ 'ClaveProdServ' => '84111506', 'Cantidad' => '1', 'ClaveUnidad' => 'ACT', 'Descripcion' => 'Pago', 'ValorUnitario' => '0', 'Importe' => '0', 'ObjetoImp' => '01', ]); $complementoPagos = new Pagos(); $pago = $complementoPagos->addPago([ 'FechaPago' => Format::datetime($fechaPago), 'FormaDePagoP' => '03', // transferencia 'MonedaP' => 'MXN', 'TipoCambioP' => '1', 'Monto' => '15000.00', 'NumOperacion' => '963852', 'RfcEmisorCtaOrd' => 'BMI9704113PA', 'CtaOrdenante' => '0001970000', 'RfcEmisorCtaBen' => 'BBA830831LJ2', 'CtaBeneficiario' => '0198005000', ]); $pago->addDoctoRelacionado([ 'IdDocumento' => '00000000-1111-2222-3333-00000000000A', 'MonedaDR' => 'MXN', 'EquivalenciaDR' => '1', 'NumParcialidad' => '2', 'ImpSaldoAnt' => '12000.00', 'ImpPagado' => '12000.00', 'ImpSaldoInsoluto' => '0', 'ObjetoImpDR' => '02', ])->getImpuestosDR()->getTrasladosDR()->addTrasladoDR([ 'ImpuestoDR' => '002', 'TipoFactorDR' => 'Tasa', 'TasaOCuotaDR' => '0.160000', 'BaseDR' => '10344.83', 'ImporteDR' => '1655.17', ]); $pago->addDoctoRelacionado([ 'IdDocumento' => '00000000-1111-2222-3333-00000000000B', 'MonedaDR' => 'MXN', 'EquivalenciaDR' => '1', 'NumParcialidad' => '1', 'ImpSaldoAnt' => '10000.00', 'ImpPagado' => '3000.00', 'ImpSaldoInsoluto' => '7000.00', 'ObjetoImpDR' => '02', ])->getImpuestosDR()->getTrasladosDR()->addTrasladoDR([ 'ImpuestoDR' => '002', 'TipoFactorDR' => 'Tasa', 'TasaOCuotaDR' => '0.160000', 'BaseDR' => '2586.21', 'ImporteDR' => '413.79', ]); // add calculated values to pagos (totales, pagos montos y pagos impuestos) PagosWriter::calculateAndPut($complementoPagos); // add the "complemento de pagos" ($complementoPagos) to the $comprobante $comprobante->addComplemento($complementoPagos); // use this method (with 0 decimals) to add attributes $creator->addSumasConceptos(null, 0); // add sello and validate to assert that the specimen does not have any errors $creator->addSello('file://' . $keyfile, ''); // this is after add sello to probe that it did not change the cadena origen or the sello $creator->moveSatDefinitionsToComprobante(); // perform validations, it should not have any error nor warnings $findings = $creator->validate(); // print_r(['validation' => ['errors' => $findings->errors(), 'warnings' => $findings->warnings()]]); $this->assertFalse( $findings->hasErrors() || $findings->hasWarnings(), 'Created document must not contain errors, fix your test specimen' ); // test that the file is the same as expected /** @see tests/assets/created-cfdi40-pago20-valid.xml */ $expectedFile = $this->utilAsset('created-cfdi40-pago20-valid.xml'); $this->assertXmlStringEqualsXmlFile($expectedFile, $creator->asXml()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/TestCase.php
tests/CfdiUtilsTests/TestCase.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Certificado\Certificado; use CfdiUtils\Certificado\SatCertificateNumber; use CfdiUtils\XmlResolver\XmlResolver; abstract class TestCase extends \PHPUnit\Framework\TestCase { public static function captureException(callable $function): ?\Throwable { try { call_user_func($function); return null; } catch (\Throwable $exception) { return $exception; } } public static function utilAsset(string $file): string { return dirname(__DIR__) . '/assets/' . $file; } protected function isRunningOnWindows(): bool { return '\\' === DIRECTORY_SEPARATOR; } protected function newResolver(): XmlResolver { return new XmlResolver(); } protected function downloadResourceIfNotExists(string $remote): string { return $this->newResolver()->resolve($remote); } public function providerFullJoin(array $first, array ...$next): array { if ([] === $next) { return $first; } $combine = []; $second = array_shift($next) ?: []; foreach ($first as $a) { foreach ($second as $b) { $combine[] = array_merge($a, $b); } } if ([] !== $next) { return $this->providerFullJoin($combine, ...$next); } return $combine; } protected function installCertificate(string $cerfile): string { $resolver = $this->newResolver(); $certificate = new Certificado('file://' . $cerfile); $certificateNumber = $certificate->getSerial(); $satCertificateNumber = new SatCertificateNumber($certificateNumber); $cerRetriever = $resolver->newCerRetriever(); $installationPath = $cerRetriever->buildPath($satCertificateNumber->remoteUrl()); if (file_exists($installationPath)) { return $installationPath; } $installationDir = dirname($installationPath); if (! file_exists($installationDir)) { mkdir($installationDir, 0774, true); } if (! is_dir($installationDir)) { throw new \RuntimeException("Cannot create installation dir $installationDir"); } if (! copy($cerfile, $installationPath)) { throw new \RuntimeException("Cannot install $cerfile into $installationPath"); } return $installationPath; } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CfdiCreatorToStringTest.php
tests/CfdiUtilsTests/CfdiCreatorToStringTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\CfdiCreator33; use PHPUnit\Framework\MockObject\MockObject; final class CfdiCreatorToStringTest extends TestCase { public function testWhenCastingToStringWithExceptionOnlyReturnsAnEmptyString(): void { /** @var CfdiCreator33&MockObject $cfdiCreator */ $cfdiCreator = $this->getMockBuilder(CfdiCreator33::class) ->setMethods(['asXml']) ->getMock(); $cfdiCreator->method('asXml')->willThrowException(new \RuntimeException('exception')); $this->assertSame('', (string)$cfdiCreator); } public function testCastToStringReturnAValidXml(): void { $cfdiCreator = new CfdiCreator33(); $xml = $cfdiCreator->asXml(); $this->assertNotEmpty($xml); $this->assertSame($xml, (string)$cfdiCreator); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CreateComprobante40CaseTest.php
tests/CfdiUtilsTests/CreateComprobante40CaseTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Certificado\Certificado; use CfdiUtils\CfdiCreator40; use CfdiUtils\Internals\TemporaryFile; use CfdiUtils\Utils\Format; use CfdiUtils\Validate\Status; use LogicException; use RuntimeException; final class CreateComprobante40CaseTest extends TestCase { public function testCreateCfdiUsingComprobanteElement(): void { $cerfile = $this->utilAsset('certs/EKU9003173C9.cer'); $keyfile = $this->utilAsset('certs/EKU9003173C9.key.pem'); $certificado = new Certificado($cerfile); $fecha = strtotime('2023-06-18 19:20:21'); // create comprobante using creator with attributes // did not set the XmlResolver then a new XmlResolver is created using the default location $creator = new CfdiCreator40([ 'Serie' => 'XXX', 'Folio' => '0000123456', 'Fecha' => Format::datetime($fecha), 'FormaPago' => '01', // efectivo 'Moneda' => 'USD', 'TipoCambio' => Format::number(18.9008, 4), // taken from banxico 'TipoDeComprobante' => 'I', // ingreso 'Exportacion' => '01', // No aplica 'LugarExpedicion' => '52000', ], $certificado); $comprobante = $creator->comprobante(); $comprobante['MetodoPago'] = 'PUE'; // Pago en una sola exhibición $comprobante->addEmisor([ 'RegimenFiscal' => '601', // General de Ley Personas Morales ]); $comprobante->addReceptor([ 'Rfc' => 'COSC8001137NA', 'Nombre' => 'Carlos Cortés Soto', // note is an "e" with accent 'UsoCFDI' => 'G01', // Adquisición de mercancías 'RegimenFiscalReceptor' => '612', // Personas Físicas con Actividades Empresariales y Profesionales 'DomicilioFiscalReceptor' => '52000', ]); // add concepto #1 $concepto = $comprobante->addConcepto([ 'ClaveProdServ' => '52161557', // Consola portátil de juegos de computador 'NoIdentificacion' => 'GAMEPAD007', 'Cantidad' => '4', 'ClaveUnidad' => 'H87', // Pieza 'Unidad' => 'PIEZA', 'Descripcion' => 'Portable tetris gamepad pro++', 'ValorUnitario' => '500', 'Importe' => '2000', 'Descuento' => '500', // hot sale: take 4, pay only 3 'ObjetoImp' => '02', ]); $concepto->addTraslado([ 'Base' => '1500', 'Impuesto' => '002', // IVA 'TipoFactor' => 'Tasa', // this is a catalog 'TasaOCuota' => '0.160000', // this is also a catalog 'Importe' => '240', ]); $concepto->multiInformacionAduanera( ['NumeroPedimento' => '17 24 3420 7010987'], ['NumeroPedimento' => '17 24 3420 7010123'] ); // add concepto #2 $comprobante->addConcepto([ 'ClaveProdServ' => '43211914', // Pantalla pasiva lcd 'NoIdentificacion' => 'SCREEN5004', 'Cantidad' => '1', 'ClaveUnidad' => 'H87', // Pieza 'Unidad' => 'PIEZA', 'Descripcion' => 'Pantalla led 3x4" con entrada HDMI', 'ValorUnitario' => '1000', 'Importe' => '1000', 'ObjetoImp' => '02', ])->addTraslado([ 'Base' => '1000', 'Impuesto' => '002', // IVA 'TipoFactor' => 'Tasa', // this is a catalog 'TasaOCuota' => '0.160000', // this is also a catalog 'Importe' => '160', ]); // concepto #3 (freight) $comprobante->addConcepto([ // - Servicios de Transporte, Almacenaje y Correo // - Manejo y embalaje de material // - Servicios de manejo de materiales // - Tarifa de los fletes 'ClaveProdServ' => '78121603', // Tarifa de los fletes 'NoIdentificacion' => 'FLETE-MX', 'Cantidad' => '1', 'ClaveUnidad' => 'E48', // Unidad de servicio 'Unidad' => 'SERVICIO', 'Descripcion' => 'Servicio de envío de mercancías', 'ValorUnitario' => '300', 'Importe' => '300', 'ObjetoImp' => '02', ])->addTraslado([ 'Base' => '300', 'Impuesto' => '002', // IVA 'TipoFactor' => 'Tasa', // this is a catalog 'TasaOCuota' => '0.160000', // this is also a catalog 'Importe' => '48', ]); // add additional calculated information sumas sello $creator->addSumasConceptos(null, 2); $creator->addSello('file://' . $keyfile); // validate the comprobante and check it has no errors or warnings $asserts = $creator->validate(); $this->assertFalse($asserts->hasErrors()); $this->assertFalse($asserts->hasStatus(Status::warn())); // check the xml $expectedFileContents = $this->utilAsset('created-with-discounts-40.xml'); $xmlContents = $creator->asXml(); $this->assertXmlStringEqualsXmlFile($expectedFileContents, $xmlContents); $this->assertStringStartsWith('<?xml', $xmlContents); } public function testAddSelloUsingInvalidPrimaryKey(): void { $cerfile = $this->utilAsset('certs/30001000000500003456.cer'); $keyfile = $this->utilAsset('certs/EKU9003173C9_password.key.pem'); $certificado = new Certificado($cerfile); $creator = new CfdiCreator40([], $certificado); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Cannot open the private key'); $creator->addSello('file://' . $keyfile); } public function testAddSelloUsingNotMatchingPrimaryKey(): void { $cerfile = $this->utilAsset('certs/30001000000500003456.cer'); $keyfile = $this->utilAsset('certs/EKU9003173C9.key.pem'); $certificado = new Certificado($cerfile); $creator = new CfdiCreator40([], $certificado); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The private key does not belong to the current certificate'); $creator->addSello('file://' . $keyfile); } public function testBuildCadenaDeOrigenUsingXsltLocationWithoutXsltBuilder(): void { $creator = new CfdiCreator40([]); $creator->setXsltBuilder(null); $this->expectException(LogicException::class); $this->expectExceptionMessage('Cannot build the cadena de origen since there is no xslt builder'); $creator->buildCadenaDeOrigen(); } public function testSaveXml(): void { $temporaryFile = TemporaryFile::create(); $creator = new CfdiCreator40([]); $creator->saveXml($temporaryFile->getPath()); $this->assertXmlStringEqualsXmlFile( $temporaryFile->getPath(), $creator->asXml() ); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CfdiCreateObjectExceptionTest.php
tests/CfdiUtilsTests/CfdiCreateObjectExceptionTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\CfdiCreateObjectException; use LogicException; final class CfdiCreateObjectExceptionTest extends TestCase { public function testWithVersionExceptions(): void { $exceptions = [ '2.0' => $ex20 = new \UnexpectedValueException('Version 2.0 exception'), '1.5' => $ex15 = new \UnexpectedValueException('Version 1.5 exception'), ]; $exception = CfdiCreateObjectException::withVersionExceptions($exceptions); $this->assertSame('Unable to read DOMDocument as CFDI', $exception->getMessage()); $this->assertSame(['2.0', '1.5'], $exception->getVersions()); $this->assertSame($ex20, $exception->getExceptionByVersion('2.0')); $this->assertSame($ex15, $exception->getExceptionByVersion('1.5')); $this->assertSame($exceptions, $exception->getExceptions()); } public function testWithVersionNotFound(): void { $exception = CfdiCreateObjectException::withVersionExceptions([]); $this->expectException(LogicException::class); $this->expectExceptionMessage('Version 4.0 does not have any exception'); $exception->getExceptionByVersion('4.0'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CreateComprobanteWithOnlyExentosCaseTest.php
tests/CfdiUtilsTests/CreateComprobanteWithOnlyExentosCaseTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\CfdiCreator33; use CfdiUtils\CfdiCreator40; use CfdiUtils\Nodes\Node; use CfdiUtils\Nodes\XmlNodeUtils; final class CreateComprobanteWithOnlyExentosCaseTest extends TestCase { public function testCreateCcomprobante33WithOnlyExentosWriteImpuestos(): void { $creator = new CfdiCreator33([]); $comprobante = $creator->comprobante(); $comprobante->addConcepto([ 'ClaveProdServ' => '01010101', 'NoIdentificacion' => 'FOO', 'Cantidad' => '1', 'ClaveUnidad' => 'E48', 'Descripcion' => 'HONORARIOS MEDICOS', 'ValorUnitario' => '617.000000', 'Importe' => '617.000000', 'Descuento' => '144.271240', 'ObjetoImp' => '02', ])->addTraslado([ 'Impuesto' => '002', 'TipoFactor' => 'Exento', ]); // test sumasConceptos $precision = 2; $sumasConceptos = $creator->buildSumasConceptos($precision); $this->assertTrue($sumasConceptos->hasExentos()); $this->assertFalse($sumasConceptos->hasTraslados()); $this->assertFalse($sumasConceptos->hasRetenciones()); $expectedExentos = [ '002:Exento:' => [ 'TipoFactor' => 'Exento', 'Impuesto' => '002', 'Base' => 0, ], ]; $this->assertEquals($expectedExentos, $sumasConceptos->getExentos()); // test cfdi:Impuestos XML does not exists $creator->addSumasConceptos($sumasConceptos, $precision); $this->assertNull($comprobante->searchNode('cfdi:Impuestos')); } public function testCreateCcomprobante40WithOnlyExentosWriteImpuestos(): void { $creator = new CfdiCreator40([]); $comprobante = $creator->comprobante(); $comprobante->addConcepto([ 'ClaveProdServ' => '01010101', 'NoIdentificacion' => 'FOO', 'Cantidad' => '1', 'ClaveUnidad' => 'E48', 'Descripcion' => 'HONORARIOS MEDICOS', 'ValorUnitario' => '617.000000', 'Importe' => '617.000000', 'Descuento' => '144.271240', 'ObjetoImp' => '02', ])->addTraslado([ 'Base' => '472.728760', 'Impuesto' => '002', 'TipoFactor' => 'Exento', ]); // test sumasConceptos $precision = 2; $sumasConceptos = $creator->buildSumasConceptos($precision); $this->assertTrue($sumasConceptos->hasExentos()); $this->assertFalse($sumasConceptos->hasTraslados()); $this->assertFalse($sumasConceptos->hasRetenciones()); $expectedExentos = [ '002:Exento:' => [ 'TipoFactor' => 'Exento', 'Impuesto' => '002', 'Base' => 472.72876, ], ]; $this->assertEquals($expectedExentos, $sumasConceptos->getExentos()); // test cfdi:Impuestos XML $creator->addSumasConceptos($sumasConceptos, $precision); $expectedImpuestosNode = new Node('cfdi:Impuestos', [], [ new Node('cfdi:Traslados', [], [ new Node('cfdi:Traslado', ['TipoFactor' => 'Exento', 'Impuesto' => '002', 'Base' => '472.73']), ]), ]); $this->assertXmlStringEqualsXmlString( XmlNodeUtils::nodeToXmlString($expectedImpuestosNode), XmlNodeUtils::nodeToXmlString($comprobante->searchNode('cfdi:Impuestos')) ); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CfdiVersionTest.php
tests/CfdiUtilsTests/CfdiVersionTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\CfdiVersion; use CfdiUtils\Nodes\Node; use CfdiUtils\Nodes\XmlNodeUtils; final class CfdiVersionTest extends TestCase { public function providerCfdiVersion(): array { return [ '4.0' => ['4.0', 'Version', '4.0'], '3.3' => ['3.3', 'Version', '3.3'], '3.2' => ['3.2', 'version', '3.2'], '4.0 bad case' => ['', 'version', '4.0'], '3.3 bad case' => ['', 'version', '3.3'], '3.2 bad case' => ['', 'Version', '3.2'], '4.0 non set' => ['', 'Version', null], '3.3 non set' => ['', 'Version', null], '3.2 non set' => ['', 'version', null], '4.0 empty' => ['', 'Version', ''], '3.3 empty' => ['', 'Version', ''], '3.2 empty' => ['', 'version', ''], '4.0 wrong number' => ['', 'Version', '2.1'], '3.3 wrong number' => ['', 'Version', '2.1'], '3.2 wrong number' => ['', 'version', '2.0'], ]; } /** * @dataProvider providerCfdiVersion */ public function testCfdiVersion(string $expected, string $attribute, ?string $value): void { $node = new Node('cfdi', [$attribute => $value]); $cfdiVersion = new CfdiVersion(); $this->assertSame($expected, $cfdiVersion->getFromNode($node)); $this->assertSame($expected, $cfdiVersion->getFromXmlString(XmlNodeUtils::nodeToXmlString($node))); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CfdiTest.php
tests/CfdiUtilsTests/CfdiTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Cfdi; use CfdiUtils\CfdiCreateObjectException; final class CfdiTest extends TestCase { public function providerCfdiVersionNamespace(): array { return [ '4.0' => ['4.0', 'http://www.sat.gob.mx/cfd/4'], '3.3' => ['3.3', 'http://www.sat.gob.mx/cfd/3'], '3.2' => ['3.2', 'http://www.sat.gob.mx/cfd/3'], ]; } public function testNewFromStringWithEmptyXml(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('empty'); Cfdi::newFromString(''); } public function testNewFromStringWithInvalidXml(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('Cannot create a DOM Document'); Cfdi::newFromString(' '); } /** @dataProvider providerCfdiVersionNamespace */ public function testConstructWithoutNamespace(string $version, string $namespace): void { $exception = $this->captureException(function (): void { Cfdi::newFromString('<Comprobante ' . '/>'); }); $this->assertInstanceOf(CfdiCreateObjectException::class, $exception); /** @var CfdiCreateObjectException $exception */ $this->assertStringContainsString( 'namespace ' . $namespace, $exception->getExceptionByVersion($version)->getMessage() ); } /** @dataProvider providerCfdiVersionNamespace */ public function testConstructWithEmptyDomDocument(string $version): void { $exception = $this->captureException(function (): void { new Cfdi(new \DOMDocument()); }); $this->assertInstanceOf(CfdiCreateObjectException::class, $exception); /** @var CfdiCreateObjectException $exception */ $this->assertStringContainsString( 'DOM Document does not have root element', $exception->getExceptionByVersion($version)->getMessage() ); } /** @dataProvider providerCfdiVersionNamespace */ public function testInvalidCfdiRootIsNotComprobante(string $version, string $namespace): void { $exception = $this->captureException(function () use ($namespace): void { Cfdi::newFromString(sprintf('<cfdi:X xmlns:cfdi="%s"/>', $namespace)); }); $this->assertInstanceOf(CfdiCreateObjectException::class, $exception); /** @var CfdiCreateObjectException $exception */ $this->assertStringContainsString( 'Root element is not cfdi:Comprobante', $exception->getExceptionByVersion($version)->getMessage() ); } /** @dataProvider providerCfdiVersionNamespace */ public function testInvalidCfdiRootIsNotPrefixed(string $version, string $namespace): void { $exception = $this->captureException(function () use ($namespace): void { Cfdi::newFromString(sprintf('<x:Comprobante xmlns:cfdi="%s"/>', $namespace)); }); $this->assertInstanceOf(CfdiCreateObjectException::class, $exception); /** @var CfdiCreateObjectException $exception */ $this->assertStringContainsString( 'Root element is not cfdi:Comprobante', $exception->getExceptionByVersion($version)->getMessage() ); } /** @dataProvider providerCfdiVersionNamespace */ public function testInvalidCfdiRootIncorrectPrefix(string $version, string $namespace): void { $exception = $this->captureException(function () use ($namespace): void { Cfdi::newFromString(sprintf('<x:Comprobante xmlns:x="%s"/>', $namespace)); }); $this->assertInstanceOf(CfdiCreateObjectException::class, $exception); /** @var CfdiCreateObjectException $exception */ $this->assertStringContainsString( "Prefix for namespace $namespace is not \"cfdi\"", $exception->getExceptionByVersion($version)->getMessage() ); } public function testValid32(): void { $cfdi = Cfdi::newFromString( '<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" version="3.2"' . '/>' ); $this->assertEquals('3.2', $cfdi->getVersion()); } public function testValid33(): void { $cfdi = Cfdi::newFromString( '<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" Version="3.3"' . '/>' ); $this->assertEquals('3.3', $cfdi->getVersion()); } public function testValid40(): void { $cfdi = Cfdi::newFromString( '<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/4" Version="4.0"' . '/>' ); $this->assertEquals('4.0', $cfdi->getVersion()); } public function testValid33WithXmlHeader(): void { $cfdi = Cfdi::newFromString( '<?xml version="1.0" encoding="UTF-8" ?>' . '<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" Version="3.3"' . '/>' ); $this->assertEquals('3.3', $cfdi->getVersion()); } public function testVersion1980ReturnEmpty(): void { $cfdi = Cfdi::newFromString( '<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" Version="1.9.80"' . '/>' ); $this->assertEmpty($cfdi->getVersion()); } public function testVersionEmptyReturnEmpty(): void { $cfdi = Cfdi::newFromString( '<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" Version=""' . '/>' ); $this->assertEmpty($cfdi->getVersion()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CfdiQuickReaderTest.php
tests/CfdiUtilsTests/CfdiQuickReaderTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Cfdi; use CfdiUtils\QuickReader\QuickReader; final class CfdiQuickReaderTest extends TestCase { private QuickReader $comprobante; protected function setUp(): void { parent::setUp(); $contents = strval(file_get_contents($this->utilAsset('cfdi33-real.xml'))); $this->comprobante = Cfdi::newFromString($contents)->getQuickReader(); } public function testAccessToAttribute(): void { $this->assertSame('3.3', $this->comprobante['version']); } public function testAccessToNestedAttributeFirstLevel(): void { $this->assertSame('273.46', $this->comprobante->impuestos['totalImpuestosTrasladados']); } public function testSumIvasInsideTraslados(): void { $iva = 0; foreach (($this->comprobante->impuestos->traslados)('traslado') as $traslado) { if ('002' === $traslado['iMpUeStO']) { $iva = $iva + floatval($traslado['Importe']); } } $this->assertEqualsWithDelta(273.46, $iva, 0.001); } public function testAccessToNestedAttributeSecondLevel(): void { // the attribute is named originally: TotaldeTraslados $this->assertSame('27.43', $this->comprobante->complemento->impuestosLocales['TotalDeTraslados']); } public function testIterateOverChildren(): void { $sum = 0; /* * You can do these 4 ways that are the same: * * $conceptos = $this->comprobante->conceptos; * foreach ($conceptos('concepto') as $concepto) { * * foreach (($this->comprobante->conceptos)('concepto') as $concepto) { * * foreach ($this->comprobante->conceptos->__invoke('concepto') as $concepto) { */ foreach (($this->comprobante->conceptos)('concepto') as $concepto) { $sum += (float) $concepto['importe']; } $this->assertEqualsWithDelta(1709.12, $sum, 0.001); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CfdiValidator33Test.php
tests/CfdiUtilsTests/CfdiValidator33Test.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Cfdi; use CfdiUtils\CfdiCreator33; use CfdiUtils\CfdiValidator33; use CfdiUtils\Nodes\Node; use CfdiUtils\Nodes\XmlNodeUtils; final class CfdiValidator33Test extends TestCase { public function testConstructWithoutArguments(): void { $validator = new CfdiValidator33(); $this->assertTrue($validator->hasXmlResolver()); } public function testConstructWithResolver(): void { $xmlResolver = $this->newResolver(); $validator = new CfdiValidator33($xmlResolver); $this->assertSame($xmlResolver, $validator->getXmlResolver()); } public function testValidateWithIncorrectXmlString(): void { $validator = new CfdiValidator33(); $asserts = $validator->validateXml('<not-a-cfdi/>'); $this->assertTrue($asserts->hasErrors()); } public function testValidateWithIncorrectNode(): void { $validator = new CfdiValidator33(); $asserts = $validator->validateNode(new Node('not-a-cfdi')); $this->assertTrue($asserts->hasErrors()); } public function testValidateWithCorrectData(): void { $cfdiFile = $this->utilAsset('cfdi33-valid.xml'); $cfdi = Cfdi::newFromString(strval(file_get_contents($cfdiFile))); $validator = new CfdiValidator33(); $asserts = $validator->validate($cfdi->getSource(), $cfdi->getNode()); // Is already known that TFDSELLO01 is failing. // We are not creating the SelloSAT for cfdi33-valid.xml file $asserts->removeByCode('TFDSELLO01'); $this->assertFalse( $asserts->hasErrors(), 'The validation of an expected cfdi33 valid file fails,' . ' maybe you are creating a new discoverable standard validator that found a bug. Excelent!' ); } /** * Developer: Use this procedure to change the cfdi on the file 'asserts/cfdi33-valid.xml' * and show in screen the value of the Sello again * @ test */ public function procedureCreateSelloAgainOnValidCdfi33(): void { $cfdiFile = $this->utilAsset('cfdi33-valid.xml'); $pemKeyFile = $this->utilAsset('certs/EKU9003173C9.key.pem'); $node = XmlNodeUtils::nodeFromXmlString(strval(file_get_contents($cfdiFile))); $creator = CfdiCreator33::newUsingNode($node); $comprobante = $creator->comprobante(); $previous = $comprobante['Sello']; // developer: change here what you need $comprobante['TipoCambio'] = '1'; $creator->addSello('file://' . $pemKeyFile); print_r([ 'old' => $previous, 'new' => $comprobante['Sello'], ]); // echo $creator->asXml(); $this->fail('This procedure must not run in real testing'); } public function testValidateThrowsExceptionIfEmptyContent(): void { $validator = new CfdiValidator33(); $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('empty'); $validator->validate('', new Node('root')); } public function testValidateCfdi33Real(): void { $cfdiFile = $this->utilAsset('cfdi33-real.xml'); $cfdi = Cfdi::newFromString(strval(file_get_contents($cfdiFile))); $validator = new CfdiValidator33($this->newResolver()); $asserts = $validator->validate($cfdi->getSource(), $cfdi->getNode()); // $asserts->hasErrors() && print_r($asserts->errors()); $this->assertFalse( $asserts->hasErrors(), 'The validation of an expected cfdi33 real file fails' ); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/CreateComprobantePagos33CaseTest.php
tests/CfdiUtilsTests/CreateComprobantePagos33CaseTest.php
<?php namespace CfdiUtilsTests; use CfdiUtils\Certificado\Certificado; use CfdiUtils\CfdiCreator33; use CfdiUtils\Elements\Pagos10\Pagos; use CfdiUtils\Utils\Format; final class CreateComprobantePagos33CaseTest extends TestCase { public function testCreateComprobantePagos(): void { $cerfile = $this->utilAsset('certs/EKU9003173C9.cer'); $keyfile = $this->utilAsset('certs/EKU9003173C9.key.pem'); $certificado = new Certificado($cerfile); $fecha = strtotime('2023-06-18 19:20:21'); $fechaPago = strtotime('2023-05-06 07:08:09'); $creator = new CfdiCreator33(); $comprobante = $creator->comprobante(); $comprobante->addAttributes([ 'Fecha' => Format::datetime($fecha), 'TipoDeComprobante' => 'P', // pago 'LugarExpedicion' => '52000', 'Moneda' => 'XXX', ]); $creator->putCertificado($certificado, false); $comprobante->addEmisor([ 'Nombre' => 'ESCUELA KEMPER URGATE SA DE CV', 'Rfc' => 'EKU9003173C9', 'RegimenFiscal' => '601', ]); $comprobante->addReceptor(['Rfc' => 'COSC8001137NA', 'UsoCFDI' => 'P01']); // The concepto *must* have this content $comprobante->addConcepto([ 'ClaveProdServ' => '84111506', 'Cantidad' => '1', 'ClaveUnidad' => 'ACT', 'Descripcion' => 'Pago', 'ValorUnitario' => '0', 'Importe' => '0', ]); // create and populate the "complemento de pagos" // @see \CfdiUtils\Elements\Pagos10\Pagos $complementoPagos = new Pagos(); $pago = $complementoPagos->addPago([ 'FechaPago' => Format::datetime($fechaPago), 'FormaDePagoP' => '03', // transferencia 'MonedaP' => 'MXN', 'Monto' => '15000.00', 'NumOperacion' => '963852', 'RfcEmisorCtaOrd' => 'BMI9704113PA', // Monex 'CtaOrdenante' => '0001970000', 'RfcEmisorCtaBen' => 'BBA830831LJ2', // BBVA 'CtaBeneficiario' => '0198005000', ]); $pago->multiDoctoRelacionado( // add two concepts at once [ 'IdDocumento' => '00000000-1111-2222-3333-00000000000A', 'MonedaDR' => 'MXN', 'MetodoDePagoDR' => 'PPD', 'NumParcialidad' => 2, 'ImpSaldoAnt' => '12000.00', 'ImpPagado' => '12000.00', 'ImpSaldoInsoluto' => '0', ], [ 'IdDocumento' => '00000000-1111-2222-3333-00000000000B', 'MonedaDR' => 'MXN', 'MetodoDePagoDR' => 'PPD', 'NumParcialidad' => 1, 'ImpSaldoAnt' => '10000.00', 'ImpPagado' => '3000.00', 'ImpSaldoInsoluto' => '7000.00', ] ); // add the "complemento de pagos" ($complementoPagos) to the $comprobante $comprobante->addComplemento($complementoPagos); // use this method (with 0 decimals) to add attributes $creator->addSumasConceptos(null, 0); // add sello and validate to assert that the specimen does not have any errors $creator->addSello('file://' . $keyfile, ''); // this is after add sello to probe that it did not change the cadena origen or the sello $creator->moveSatDefinitionsToComprobante(); // perform validations, it should not have any error nor warnings $findings = $creator->validate(); $this->assertFalse( $findings->hasErrors() || $findings->hasWarnings(), 'Created document must not contain errors, fix your test specimen' ); // test that the file is the same as expected /** @see tests/assets/created-pago-with-ns-at-root-33.xml */ $expectedFile = $this->utilAsset('created-pago-with-ns-at-root-33.xml'); $this->assertXmlStringEqualsXmlFile($expectedFile, $creator->asXml()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Internals/CommandTemplateTest.php
tests/CfdiUtilsTests/Internals/CommandTemplateTest.php
<?php namespace CfdiUtilsTests\Internals; use CfdiUtils\Internals\CommandTemplate; use CfdiUtilsTests\TestCase; final class CommandTemplateTest extends TestCase { public function providerTemplateCommandToArrayArguments(): array { return [ 'first argument' => ['? fire', ['command'], ['command', 'fire']], 'no argument' => ['foo bar baz', [], ['foo', 'bar', 'baz']], 'replace with 2 replacements' => ['foo ? => ?', ['bar', 'baz'], ['foo', 'bar', '=>', 'baz']], 'replace spaces' => ['foo ? => ? x', ['bar', 'baz'], ['foo', 'bar', '=>', 'baz', 'x']], 'more ? than arguments' => ['foo ? => ? x', [], ['foo', '', '=>', '', 'x']], 'less ? than arguments' => ['foo ? => ?', ['bar'], ['foo', 'bar', '=>', '']], ]; } /** * @dataProvider providerTemplateCommandToArrayArguments */ public function testCreateCommandFromTemplate(string $template, array $arguments, array $expected): void { $builder = new CommandTemplate(); $command = $builder->create($template, $arguments); $this->assertSame($expected, $command); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Internals/BaseConverterSequenceTest.php
tests/CfdiUtilsTests/Internals/BaseConverterSequenceTest.php
<?php namespace CfdiUtilsTests\Internals; use CfdiUtils\Internals\BaseConverterSequence; use PHPUnit\Framework\TestCase; final class BaseConverterSequenceTest extends TestCase { public function testValidSequence(): void { $source = 'ABCD'; $sequence = new BaseConverterSequence($source); $this->assertSame($source, $sequence->value()); $this->assertSame(4, $sequence->length()); $this->assertSame($source, strval($sequence)); } public function testInvalidSequenceWithEmptyString(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('Sequence does not contains enough elements'); new BaseConverterSequence(''); } public function testInvalidSequenceWithOneChar(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('Sequence does not contains enough elements'); new BaseConverterSequence('X'); } public function testInvalidSequenceWithMultibyte(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('multibyte'); new BaseConverterSequence('Ñ'); } public function testInvalidSequenceWithRepeatedChars(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('The sequence has not unique values'); new BaseConverterSequence('ABCBA'); } public function testInvalidSequenceWithRepeatedCharsDifferentCase(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('The sequence has not unique values'); new BaseConverterSequence('ABCDabcd'); } public function testIsValidMethod(): void { $this->assertTrue(BaseConverterSequence::isValid('abc')); $this->assertFalse(BaseConverterSequence::isValid('abcb')); $this->assertFalse(BaseConverterSequence::isValid('')); $this->assertFalse(BaseConverterSequence::isValid('0')); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Internals/TemporaryFileTest.php
tests/CfdiUtilsTests/Internals/TemporaryFileTest.php
<?php namespace CfdiUtilsTests\Internals; use CfdiUtils\Internals\TemporaryFile; use CfdiUtilsTests\TestCase; final class TemporaryFileTest extends TestCase { public function testBasicFunctionality(): void { $temp = TemporaryFile::create(); $this->assertFileExists($temp->getPath()); $temp->remove(); $this->assertFileDoesNotExist($temp->getPath()); } public function testCreateWithDirectory(): void { $temp = TemporaryFile::create(__DIR__); try { $path = $temp->getPath(); $this->assertSame(__DIR__, dirname($path)); $this->assertFileExists($path); } finally { $temp->remove(); // cleanup } } public function testCreateOnNonExistentFolderThrowsException(): void { $directory = __DIR__ . '/non/existent/directory/'; $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Unable to create a temporary file'); TemporaryFile::create($directory); } public function testCreateOnReadOnlyDirectoryThrowsException(): void { // prepare directory $directory = __DIR__ . '/readonly'; mkdir($directory, 0500); // skip if it was not writable if (is_writable($directory)) { rmdir($directory); $this->markTestSkipped('Cannot create a read-only directory'); } // setup expected exception $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Unable to create a temporary file'); // enclose on try {} finally {} for directory clean up try { TemporaryFile::create($directory); } finally { // clean up chmod($directory, 0777); rmdir($directory); } } public function testObjectToStringBehavior(): void { $file = TemporaryFile::create(); $this->assertSame($file->getPath(), (string) $file); $file->remove(); } public function testReadAndWrite(): void { $content = 'Lorem Ipsum'; $file = TemporaryFile::create(); $this->assertSame('', $file->retriveContents(), 'Contents should be empty'); $file->storeContents($content); $this->assertSame($content, $file->retriveContents(), 'Contents should be what we have store'); $file->remove(); } public function testRunAndRemoveGreenPath(): void { $file = TemporaryFile::create(); $expected = 'foo'; $retrieved = $file->runAndRemove(fn (): string => $expected); $this->assertSame($expected, $retrieved, 'Method did not return the expected value'); $this->assertFileDoesNotExist($file->getPath()); } public function testRunAndRemoveWithException(): void { $file = TemporaryFile::create(); try { $file->runAndRemove(function (): void { throw new \RuntimeException('DUMMY'); }); } catch (\RuntimeException $exception) { if ('DUMMY' !== $exception->getMessage()) { throw new \RuntimeException('Expected exception was not thrown', 0, $exception); } } $this->assertFileDoesNotExist($file->getPath()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Internals/BaseConverterTest.php
tests/CfdiUtilsTests/Internals/BaseConverterTest.php
<?php namespace CfdiUtilsTests\Internals; use CfdiUtils\Internals\BaseConverter; use CfdiUtils\Internals\BaseConverterSequence; use PHPUnit\Framework\TestCase; final class BaseConverterTest extends TestCase { public function testBasicFunctionality(): void { $hexSequence = new BaseConverterSequence('0123456789ABCDEF'); $converter = new BaseConverter($hexSequence); $this->assertSame($hexSequence, $converter->sequence()); $this->assertSame(16, $converter->maximumBase()); $input = 'FFFF'; $expected = base_convert($input, 16, 2); $this->assertSame($expected, $converter->convert($input, 16, 2)); } public function testConvertEmptyString(): void { $converter = BaseConverter::createBase36(); $this->assertSame('0', $converter->convert('', 10, 2)); } /** * @testWith [-1] * [0] * [1] * [37] */ public function testInvalidFromBase(int $base): void { $converter = BaseConverter::createBase36(); $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('Invalid from base'); $converter->convert('', $base, 16); } /** * @testWith [-1] * [0] * [1] * [37] */ public function testInvalidToBase(int $base): void { $converter = BaseConverter::createBase36(); $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('Invalid to base'); $converter->convert('', 16, $base); } public function testConvertWithInputNotIsSequence(): void { $converter = BaseConverter::createBase36(); $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('The number to convert contains invalid characters'); $converter->convert('@', 16, 10); } public function testConvertUsingLongInput(): void { // this is the main reason to exists of BaseConverter class // since base_convert cannot handle large inputs $input = '3330303031303030303030333030303233373038'; $expected = '292233162870206001759766198425879490508935868472'; $converter = BaseConverter::createBase36(); $this->assertSame($expected, $converter->convert($input, 16, 10)); } public function testConvertZeroUsingSameBase(): void { $input = '0000000'; $expected = '0'; $converter = BaseConverter::createBase36(); $this->assertSame($expected, $converter->convert($input, 2, 2)); } public function testConvertZeroUsingDifferentBase(): void { $input = '0000000'; $expected = '0'; $converter = BaseConverter::createBase36(); $this->assertSame($expected, $converter->convert($input, 2, 4)); } public function testConvertZeroUsingLettersSequence(): void { // base_convert(501020304050607, 8, 16) => 141083105187 // 501020304050607 $input = 'FABACADAEAFAGAH'; // 141083105187 $expected = 'BEBAIDBAFBIH'; $converter = new BaseConverter(new BaseConverterSequence('ABCDEFGHIJKLMNOPQRSTUVWXYZ')); $this->assertSame($expected, $converter->convert($input, 8, 16)); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/ElementTestCase.php
tests/CfdiUtilsTests/Elements/ElementTestCase.php
<?php namespace CfdiUtilsTests\Elements; use CfdiUtils\Elements\Common\AbstractElement; use CfdiUtils\Nodes\Node; use CfdiUtilsTests\TestCase; abstract class ElementTestCase extends TestCase { public function assertElementHasName(AbstractElement $element, string $name): void { $this->assertSame( $name, $element->getElementName(), sprintf('The element %s must have the name "%s"', $element::class, $name) ); } public function assertElementHasFixedAttributes(AbstractElement $element, array $attributes): void { $elementClass = $element::class; foreach ($attributes as $name => $value) { $this->assertSame( $element[$name], $value, sprintf('The element %s must have the attribute "%s" with value "%s"', $elementClass, $name, $value) ); } } public function assertElementHasOrder(AbstractElement $element, array $order): void { $this->assertSame( $order, $element->children()->getOrder(), sprintf('The element %s does not have the correct child order definition', $element::class) ); } public function assertElementHasChildSingle( AbstractElement $element, string $childClassName, string $getter = '', string $adder = '', ): void { $elementClass = $element::class; $childClassBaseName = basename(str_replace('\\', '/', $childClassName)); $element->children()->removeAll(); // element should return the same instance $getter = $getter ?: 'get' . $childClassBaseName; $instance = $element->{$getter}(); $this->assertInstanceOf( $childClassName, $instance, sprintf('The method %s::%s should return the an instance of %s', $elementClass, $getter, $childClassName) ); $this->assertSame( $instance, $element->{$getter}(), sprintf('The method %s::%s should return always the same instance', $elementClass, $getter) ); // add should work on the same object $adder = $adder ?: 'add' . $childClassBaseName; $second = $element->{$adder}(['foo' => 'bar']); $this->assertInstanceOf( $childClassName, $second, sprintf('The method %s::%s should return the an instance of %s', $elementClass, $adder, $childClassName) ); $this->assertSame( 'bar', $instance['foo'], sprintf('The method %s::%s should write the attributes on the same instance', $elementClass, $adder) ); } public function assertElementHasChildSingleAddChild( AbstractElement $element, string $childClassName, ): void { $elementClass = $element::class; $childClassBaseName = basename(str_replace('\\', '/', $childClassName)); $element->children()->removeAll(); // element should return the same instance $getter = 'get' . $childClassBaseName; $instance = $element->{$getter}(); $this->assertInstanceOf( $childClassName, $instance, sprintf('The method %s::%s should return the an instance of %s', $elementClass, $getter, $childClassName) ); $this->assertSame( $instance, $element->{$getter}(), sprintf('The method %s::%s should return always the same instance', $elementClass, $getter) ); // add should append a child into the existent node $adder = 'add' . $childClassBaseName; $firstChild = new Node('child1'); $returnOnAdder = $element->{$adder}($firstChild); $this->assertSame( $element, $returnOnAdder, sprintf('The method %s::%s should return always the element instance', $elementClass, $getter) ); $this->assertSame( [$firstChild], iterator_to_array($instance->children()), 'The first child should be added to the element\'s children' ); $secondChild = new Node('child2'); $element->{$adder}($secondChild); $this->assertSame( [$firstChild, $secondChild], iterator_to_array($instance->children()), 'The second child should be added to the element\'s children' ); } public function assertElementHasChildMultiple( AbstractElement $element, string $childClassName, string $elementName = '', ): void { $elementClass = $element::class; $elementName = $elementName ?: basename(str_replace('\\', '/', $childClassName)); $element->children()->removeAll(); // first: add should return specific instance and added $adder = 'add' . $elementName; $first = $element->{$adder}(['id' => 'first']); $this->assertInstanceOf( $childClassName, $first, sprintf('The method %s::%s should return the an instance of %s', $elementClass, $adder, $childClassName) ); $this->assertSame( 'first', $first['id'], sprintf('The method %s::%s should write the attributes', $elementClass, $adder) ); $this->assertCount(1, $element->children()); // second: add should return other instance different from first but added $second = $element->{$adder}(['id' => 'second']); $this->assertNotSame( $first, $second, sprintf('The method %s::%s should return a new instance of %s', $elementClass, $adder, $childClassName) ); $this->assertSame( 'second', $second['id'], sprintf('The method %s::%s should write the attributes', $elementClass, $adder) ); $this->assertCount(2, $element->children()); // multiple: add should return other instance different from first but added $multier = 'multi' . $elementName; $sameAsElement = $element->{$multier}(['id' => 'third'], ['id' => 'fourth']); $this->assertSame( $element, $sameAsElement, sprintf( 'The method %s::%s should return the same element as the instance contained', $elementClass, $multier ) ); $this->assertCount(4, $element->children()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/TrasladoTest.php
tests/CfdiUtilsTests/Elements/Pagos10/TrasladoTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\Traslado; use PHPUnit\Framework\TestCase; final class TrasladoTest extends TestCase { public Traslado $element; protected function setUp(): void { parent::setUp(); $this->element = new Traslado(); } public function testGetElementName(): void { $this->assertSame('pago10:Traslado', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/PagoTest.php
tests/CfdiUtilsTests/Elements/Pagos10/PagoTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\DoctoRelacionado; use CfdiUtils\Elements\Pagos10\Impuestos; use CfdiUtils\Elements\Pagos10\Pago; use PHPUnit\Framework\TestCase; final class PagoTest extends TestCase { public Pago $element; protected function setUp(): void { parent::setUp(); $this->element = new Pago(); } public function testConstructedObject(): void { $this->assertSame('pago10:Pago', $this->element->getElementName()); } public function testDoctoRelacionado(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addDoctoRelacionado(['id' => 'first']); $this->assertInstanceOf(DoctoRelacionado::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addDoctoRelacionado(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } public function testImpuestos(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addImpuestos(['id' => 'first']); $this->assertInstanceOf(Impuestos::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addImpuestos(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } public function testChildrenOrder(): void { // add in inverse order $this->element->addImpuestos(); $this->element->addDoctoRelacionado(); // retrieve in correct order $this->assertInstanceOf(DoctoRelacionado::class, $this->element->children()->get(0)); $this->assertInstanceOf(Impuestos::class, $this->element->children()->get(1)); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/DoctoRelacionadoTest.php
tests/CfdiUtilsTests/Elements/Pagos10/DoctoRelacionadoTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\DoctoRelacionado; use PHPUnit\Framework\TestCase; final class DoctoRelacionadoTest extends TestCase { public DoctoRelacionado $element; protected function setUp(): void { parent::setUp(); $this->element = new DoctoRelacionado(); } public function testConstructedObject(): void { $this->assertSame('pago10:DoctoRelacionado', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/ImpuestosTest.php
tests/CfdiUtilsTests/Elements/Pagos10/ImpuestosTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\Impuestos; use CfdiUtils\Elements\Pagos10\Retenciones; use CfdiUtils\Elements\Pagos10\Traslados; use PHPUnit\Framework\TestCase; final class ImpuestosTest extends TestCase { public Impuestos $element; protected function setUp(): void { parent::setUp(); $this->element = new Impuestos(); } public function testConstructedObject(): void { $this->assertSame('pago10:Impuestos', $this->element->getElementName()); } public function testGetTraslados(): void { $this->assertNull($this->element->searchNode('pago10:Traslados')); $child = $this->element->getTraslados(); $this->assertInstanceOf(Traslados::class, $child); $this->assertSame($child, $this->element->searchNode('pago10:Traslados')); } public function testGetRetenciones(): void { $this->assertNull($this->element->searchNode('pago10:Retenciones')); $child = $this->element->getRetenciones(); $this->assertInstanceOf(Retenciones::class, $child); $this->assertSame($child, $this->element->searchNode('pago10:Retenciones')); } public function testChildrenOrder(): void { // add in inverse order $this->element->getTraslados(); $this->element->getRetenciones(); // retrieve in correct order $this->assertInstanceOf(Retenciones::class, $this->element->children()->get(0)); $this->assertInstanceOf(Traslados::class, $this->element->children()->get(1)); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/TrasladosTest.php
tests/CfdiUtilsTests/Elements/Pagos10/TrasladosTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\Traslado; use CfdiUtils\Elements\Pagos10\Traslados; use PHPUnit\Framework\TestCase; final class TrasladosTest extends TestCase { public Traslados $element; protected function setUp(): void { parent::setUp(); $this->element = new Traslados(); } public function testGetElementName(): void { $this->assertSame('pago10:Traslados', $this->element->getElementName()); } public function testAddTraslado(): void { $parent = $this->element; // no childs $this->assertCount(0, $parent); // add first child $first = $this->element->addTraslado(['name' => 'first']); $this->assertInstanceOf(Traslado::class, $first); $this->assertSame('first', $first['name']); $this->assertCount(1, $this->element); // add second child $second = $this->element->addTraslado(); $this->assertCount(2, $this->element); // test that first and second are not the same $this->assertNotSame($first, $second); } public function testMultiTraslado(): void { $node = $this->element; $this->assertCount(0, $node); $multiReturn = $node->multiTraslado( ['id' => 'first'], ['id' => 'second'] ); $this->assertSame($multiReturn, $node); $this->assertCount(2, $node); $this->assertSame('first', $node->searchAttribute('pago10:Traslado', 'id')); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/PagosTest.php
tests/CfdiUtilsTests/Elements/Pagos10/PagosTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\Pago; use CfdiUtils\Elements\Pagos10\Pagos; use PHPUnit\Framework\TestCase; final class PagosTest extends TestCase { public Pagos $element; protected function setUp(): void { parent::setUp(); $this->element = new Pagos(); } public function testConstructedObject(): void { $this->assertSame('pago10:Pagos', $this->element->getElementName()); } public function testAddPago(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addPago(['id' => 'first']); $this->assertInstanceOf(Pago::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addPago(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } public function testMultiPago(): void { $node = $this->element; $this->assertCount(0, $node); $multiReturn = $node->multiPago( ['id' => 'first'], ['id' => 'second'] ); $this->assertSame($multiReturn, $node); $this->assertCount(2, $node); $this->assertSame('first', $node->searchAttribute('pago10:Pago', 'id')); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/RetencionesTest.php
tests/CfdiUtilsTests/Elements/Pagos10/RetencionesTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\Retencion; use CfdiUtils\Elements\Pagos10\Retenciones; use PHPUnit\Framework\TestCase; final class RetencionesTest extends TestCase { public Retenciones $element; protected function setUp(): void { parent::setUp(); $this->element = new Retenciones(); } public function testGetElementName(): void { $this->assertSame('pago10:Retenciones', $this->element->getElementName()); } public function testAddRetencion(): void { $parent = $this->element; // no childs $this->assertCount(0, $parent); // add first child $first = $this->element->addRetencion(['name' => 'first']); $this->assertInstanceOf(Retencion::class, $first); $this->assertSame('first', $first['name']); $this->assertCount(1, $this->element); // add second child $second = $this->element->addRetencion(); $this->assertCount(2, $this->element); // test that first and second are not the same $this->assertNotSame($first, $second); } public function testMultiRetencion(): void { $node = $this->element; $this->assertCount(0, $node); $multiReturn = $node->multiRetencion( ['id' => 'first'], ['id' => 'second'] ); $this->assertSame($multiReturn, $node); $this->assertCount(2, $node); $this->assertSame('first', $node->searchAttribute('pago10:Retencion', 'id')); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos10/RetencionTest.php
tests/CfdiUtilsTests/Elements/Pagos10/RetencionTest.php
<?php namespace CfdiUtilsTests\Elements\Pagos10; use CfdiUtils\Elements\Pagos10\Retencion; use PHPUnit\Framework\TestCase; final class RetencionTest extends TestCase { public Retencion $element; protected function setUp(): void { parent::setUp(); $this->element = new Retencion(); } public function testGetElementName(): void { $this->assertSame('pago10:Retencion', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/OperadoresTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/OperadoresTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Operador; use CfdiUtils\Elements\CartaPorte10\Operadores; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Operadores */ final class OperadoresTest extends TestCase { public Operadores $element; protected function setUp(): void { parent::setUp(); $this->element = new Operadores(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Operadores', $this->element->getElementName()); } public function testAddOperador(): void { // insert first element $first = $this->element->addOperador(['id' => 'first']); $this->assertInstanceOf(Operador::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addOperador(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiOperador(): void { // insert first element $operadores = $this->element->multiOperador( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $operadores); $this->assertSame($this->element, $operadores); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/FiguraTransporteTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/FiguraTransporteTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Arrendatario; use CfdiUtils\Elements\CartaPorte10\FiguraTransporte; use CfdiUtils\Elements\CartaPorte10\Notificado; use CfdiUtils\Elements\CartaPorte10\Operadores; use CfdiUtils\Elements\CartaPorte10\Propietario; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\FiguraTransporte */ final class FiguraTransporteTest extends TestCase { public FiguraTransporte $element; protected function setUp(): void { parent::setUp(); $this->element = new FiguraTransporte(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:FiguraTransporte', $this->element->getElementName()); } public function testAddOperadores(): void { // insert first element $first = $this->element->addOperadores(['id' => 'first']); $this->assertInstanceOf(Operadores::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addOperadores(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiOperadores(): void { // insert first element $operadores = $this->element->multiOperadores( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $operadores); $this->assertSame($this->element, $operadores); } public function testAddPropietario(): void { // insert first element $first = $this->element->addPropietario(['id' => 'first']); $this->assertInstanceOf(Propietario::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addPropietario(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiPropietario(): void { // insert first element $propietario = $this->element->multiPropietario( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $propietario); $this->assertSame($this->element, $propietario); } public function testAddArrendatario(): void { // insert first element $first = $this->element->addArrendatario(['id' => 'first']); $this->assertInstanceOf(Arrendatario::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addArrendatario(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiArrendatario(): void { // insert first element $arrendatario = $this->element->multiArrendatario( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $arrendatario); $this->assertSame($this->element, $arrendatario); } public function testAddNotificado(): void { // insert first element $first = $this->element->addNotificado(['id' => 'first']); $this->assertInstanceOf(Notificado::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addNotificado(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiNotificado(): void { // insert first element $notificado = $this->element->multiNotificado( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $notificado); $this->assertSame($this->element, $notificado); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/MercanciasTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/MercanciasTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\AutotransporteFederal; use CfdiUtils\Elements\CartaPorte10\Mercancia; use CfdiUtils\Elements\CartaPorte10\Mercancias; use CfdiUtils\Elements\CartaPorte10\TransporteAereo; use CfdiUtils\Elements\CartaPorte10\TransporteFerroviario; use CfdiUtils\Elements\CartaPorte10\TransporteMaritimo; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Mercancias */ final class MercanciasTest extends TestCase { public Mercancias $element; protected function setUp(): void { parent::setUp(); $this->element = new Mercancias(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Mercancias', $this->element->getElementName()); } public function testAddMercancia(): void { // insert first element $first = $this->element->addMercancia(['id' => 'first']); $this->assertInstanceOf(Mercancia::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addMercancia(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiMercancia(): void { // insert first element $mercancias = $this->element->multiMercancia( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $mercancias); $this->assertSame($this->element, $mercancias); } public function testAddAutotransporteFederal(): void { // insert first element $first = $this->element->addAutotransporteFederal(['id' => 'first']); $this->assertInstanceOf(AutotransporteFederal::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addAutotransporteFederal(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testAddTransporteMaritimo(): void { // insert first element $first = $this->element->addTransporteMaritimo(['id' => 'first']); $this->assertInstanceOf(TransporteMaritimo::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addTransporteMaritimo(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testAddTransporteAereo(): void { // insert first element $first = $this->element->addTransporteAereo(['id' => 'first']); $this->assertInstanceOf(TransporteAereo::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addTransporteAereo(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testAddTransporteFerroviario(): void { // insert first element $first = $this->element->addTransporteFerroviario(['id' => 'first']); $this->assertInstanceOf(TransporteFerroviario::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addTransporteFerroviario(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/OrigenTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/OrigenTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Origen; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Origen */ final class OrigenTest extends TestCase { public Origen $element; protected function setUp(): void { parent::setUp(); $this->element = new Origen(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Origen', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/TransporteMaritimoTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/TransporteMaritimoTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Contenedor; use CfdiUtils\Elements\CartaPorte10\TransporteMaritimo; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\TransporteMaritimo */ final class TransporteMaritimoTest extends TestCase { public TransporteMaritimo $element; protected function setUp(): void { parent::setUp(); $this->element = new TransporteMaritimo(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:TransporteMaritimo', $this->element->getElementName()); } public function testAddContenedor(): void { // insert first element $first = $this->element->addContenedor(['id' => 'first']); $this->assertInstanceOf(Contenedor::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addContenedor(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiContenedor(): void { // insert first element $contenedores = $this->element->multiContenedor( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $contenedores); $this->assertSame($this->element, $contenedores); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/IdentificacionVehicularTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/IdentificacionVehicularTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\IdentificacionVehicular; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\IdentificacionVehicular */ final class IdentificacionVehicularTest extends TestCase { public IdentificacionVehicular $element; protected function setUp(): void { parent::setUp(); $this->element = new IdentificacionVehicular(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:IdentificacionVehicular', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/MercanciaTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/MercanciaTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\CantidadTransporta; use CfdiUtils\Elements\CartaPorte10\DetalleMercancia; use CfdiUtils\Elements\CartaPorte10\Mercancia; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Mercancia */ final class MercanciaTest extends TestCase { public Mercancia $element; protected function setUp(): void { parent::setUp(); $this->element = new Mercancia(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Mercancia', $this->element->getElementName()); } public function testAddCantidadTransporta(): void { // insert first element $first = $this->element->addCantidadTransporta(['id' => 'first']); $this->assertInstanceOf(CantidadTransporta::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addCantidadTransporta(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiCantidadTransporta(): void { // insert first element $cantidadTransportaNodes = $this->element->multiCantidadTransporta( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $cantidadTransportaNodes); $this->assertSame($this->element, $cantidadTransportaNodes); } public function testGetDetalleMercancia(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:DetalleMercancia')); $first = $this->element->getDetalleMercancia(); $this->assertCount(1, $this->element->searchNodes('cartaporte:DetalleMercancia')); $second = $this->element->getDetalleMercancia(); $this->assertCount(1, $this->element->searchNodes('cartaporte:DetalleMercancia')); $this->assertSame($first, $second); } public function testAddDetalleMercancia(): void { // insert first element $first = $this->element->addDetalleMercancia(['id' => 'first']); $this->assertInstanceOf(DetalleMercancia::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addDetalleMercancia(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/UbicacionesTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/UbicacionesTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Ubicacion; use CfdiUtils\Elements\CartaPorte10\Ubicaciones; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Ubicaciones */ final class UbicacionesTest extends TestCase { public Ubicaciones $element; protected function setUp(): void { parent::setUp(); $this->element = new Ubicaciones(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Ubicaciones', $this->element->getElementName()); } public function testAddUbicacion(): void { // insert first element $first = $this->element->addUbicacion(['id' => 'first']); $this->assertInstanceOf(Ubicacion::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addUbicacion(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiUbicacion(): void { // insert first element $ubicaciones = $this->element->multiUbicacion( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $ubicaciones); $this->assertSame($this->element, $ubicaciones); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/NotificadoTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/NotificadoTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Domicilio; use CfdiUtils\Elements\CartaPorte10\Notificado; use CfdiUtilsTests\Elements\ElementTestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Notificado */ final class NotificadoTest extends ElementTestCase { public Notificado $element; protected function setUp(): void { parent::setUp(); $this->element = new Notificado(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Notificado', $this->element->getElementName()); } public function testDomicilio(): void { $this->assertElementHasChildSingle($this->element, Domicilio::class); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/CartaPorteTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/CartaPorteTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\CartaPorte; use CfdiUtils\Elements\CartaPorte10\FiguraTransporte; use CfdiUtils\Elements\CartaPorte10\Mercancias; use CfdiUtils\Elements\CartaPorte10\Ubicaciones; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\CartaPorte */ final class CartaPorteTest extends TestCase { public CartaPorte $element; protected function setUp(): void { parent::setUp(); $this->element = new CartaPorte(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:CartaPorte', $this->element->getElementName()); } public function testChildrenOrder(): void { $expected = [ 'cartaporte:Ubicaciones', 'cartaporte:Mercancias', 'cartaporte:FiguraTransporte', ]; $this->assertSame($expected, $this->element->getChildrenOrder()); } public function testFixedVersion(): void { $this->assertSame('1.0', $this->element['Version']); } public function testFixedNamespaceDefinition(): void { $namespace = 'http://www.sat.gob.mx/cartaporte'; $this->assertSame($namespace, $this->element['xmlns:cartaporte']); $xsdLocation = 'http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte.xsd'; $this->assertSame($namespace . ' ' . $xsdLocation, $this->element['xsi:schemaLocation']); } public function testGetUbicaciones(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Ubicaciones')); $first = $this->element->getUbicaciones(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Ubicaciones')); $second = $this->element->getUbicaciones(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Ubicaciones')); $this->assertSame($first, $second); } public function testAddUbicaciones(): void { // insert first element $first = $this->element->addUbicaciones(['id' => 'first']); $this->assertInstanceOf(Ubicaciones::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addUbicaciones(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetMercancias(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Mercancias')); $first = $this->element->getMercancias(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Mercancias')); $second = $this->element->getMercancias(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Mercancias')); $this->assertSame($first, $second); } public function testAddMercancias(): void { // insert first element $first = $this->element->addMercancias(['id' => 'first']); $this->assertInstanceOf(Mercancias::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addMercancias(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetFiguraTransporte(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:FiguraTransporte')); $first = $this->element->getFiguraTransporte(); $this->assertCount(1, $this->element->searchNodes('cartaporte:FiguraTransporte')); $second = $this->element->getFiguraTransporte(); $this->assertCount(1, $this->element->searchNodes('cartaporte:FiguraTransporte')); $this->assertSame($first, $second); } public function testAddFiguraTransporte(): void { // insert first element $first = $this->element->addFiguraTransporte(['id' => 'first']); $this->assertInstanceOf(FiguraTransporte::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addFiguraTransporte(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/UbicacionTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/UbicacionTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Destino; use CfdiUtils\Elements\CartaPorte10\Domicilio; use CfdiUtils\Elements\CartaPorte10\Origen; use CfdiUtils\Elements\CartaPorte10\Ubicacion; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Ubicacion */ final class UbicacionTest extends TestCase { public Ubicacion $element; protected function setUp(): void { parent::setUp(); $this->element = new Ubicacion(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Ubicacion', $this->element->getElementName()); } public function testChildrenOrder(): void { $expected = ['cartaporte:Origen', 'cartaporte:Destino', 'cartaporte:Domicilio']; $this->assertSame($expected, $this->element->getChildrenOrder()); } public function testGetOrigen(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Origen')); $first = $this->element->getOrigen(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Origen')); $second = $this->element->getOrigen(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Origen')); $this->assertSame($first, $second); } public function testAddOrigen(): void { // insert first element $first = $this->element->addOrigen(['id' => 'first']); $this->assertInstanceOf(Origen::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addOrigen(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetDestino(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Destino')); $first = $this->element->getDestino(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Destino')); $second = $this->element->getDestino(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Destino')); $this->assertSame($first, $second); } public function testAddDestino(): void { // insert first element $first = $this->element->addDestino(['id' => 'first']); $this->assertInstanceOf(Destino::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addDestino(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetDomicilio(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Domicilio')); $first = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $second = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $this->assertSame($first, $second); } public function testAddDomicilio(): void { // insert first element $first = $this->element->addDomicilio(['id' => 'first']); $this->assertInstanceOf(Domicilio::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addDomicilio(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/CantidadTransportaTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/CantidadTransportaTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\CantidadTransporta; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\CantidadTransporta */ final class CantidadTransportaTest extends TestCase { public CantidadTransporta $element; protected function setUp(): void { parent::setUp(); $this->element = new CantidadTransporta(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:CantidadTransporta', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/AutotransporteFederalTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/AutotransporteFederalTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\AutotransporteFederal; use CfdiUtils\Elements\CartaPorte10\IdentificacionVehicular; use CfdiUtils\Elements\CartaPorte10\Remolques; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\AutotransporteFederal */ final class AutotransporteFederalTest extends TestCase { public AutotransporteFederal $element; protected function setUp(): void { parent::setUp(); $this->element = new AutotransporteFederal(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:AutotransporteFederal', $this->element->getElementName()); } public function testGetIdentificacionVehicular(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:IdentificacionVehicular')); $first = $this->element->getIdentificacionVehicular(); $this->assertCount(1, $this->element->searchNodes('cartaporte:IdentificacionVehicular')); $second = $this->element->getIdentificacionVehicular(); $this->assertCount(1, $this->element->searchNodes('cartaporte:IdentificacionVehicular')); $this->assertSame($first, $second); } public function testAddIdentificacionVehicular(): void { // insert first element $first = $this->element->addIdentificacionVehicular(['id' => 'first']); $this->assertInstanceOf(IdentificacionVehicular::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addIdentificacionVehicular(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testGetRemolques(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Remolques')); $first = $this->element->getRemolques(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Remolques')); $second = $this->element->getRemolques(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Remolques')); $this->assertSame($first, $second); } public function testAddRemolques(): void { // insert first element $first = $this->element->addRemolques(['id' => 'first']); $this->assertInstanceOf(Remolques::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addRemolques(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/DetalleMercanciaTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/DetalleMercanciaTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\DetalleMercancia; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\DetalleMercancia */ final class DetalleMercanciaTest extends TestCase { public DetalleMercancia $element; protected function setUp(): void { parent::setUp(); $this->element = new DetalleMercancia(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:DetalleMercancia', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/DomicilioTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/DomicilioTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Domicilio; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Domicilio */ final class DomicilioTest extends TestCase { public Domicilio $element; protected function setUp(): void { parent::setUp(); $this->element = new Domicilio(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Domicilio', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/ArrendatarioTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/ArrendatarioTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Arrendatario; use CfdiUtils\Elements\CartaPorte10\Domicilio; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Arrendatario */ final class ArrendatarioTest extends TestCase { public Arrendatario $element; protected function setUp(): void { parent::setUp(); $this->element = new Arrendatario(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Arrendatario', $this->element->getElementName()); } public function testGetDomicilio(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Domicilio')); $first = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $second = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $this->assertSame($first, $second); } public function testAddDomicilio(): void { // insert first element $first = $this->element->addDomicilio(['id' => 'first']); $this->assertInstanceOf(Domicilio::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addDomicilio(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/RemolqueTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/RemolqueTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Remolque; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Remolque */ final class RemolqueTest extends TestCase { public Remolque $element; protected function setUp(): void { parent::setUp(); $this->element = new Remolque(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Remolque', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/CarroTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/CarroTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Carro; use CfdiUtils\Elements\CartaPorte10\Contenedor; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Carro */ final class CarroTest extends TestCase { public Carro $element; protected function setUp(): void { parent::setUp(); $this->element = new Carro(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Carro', $this->element->getElementName()); } public function testAddContenedor(): void { // insert first element $first = $this->element->addContenedor(['id' => 'first']); $this->assertInstanceOf(Contenedor::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addContenedor(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiContenedor(): void { // insert first element $contenedores = $this->element->multiContenedor( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $contenedores); $this->assertSame($this->element, $contenedores); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/ContenedorTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/ContenedorTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Contenedor; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Contenedor */ final class ContenedorTest extends TestCase { public Contenedor $element; protected function setUp(): void { parent::setUp(); $this->element = new Contenedor(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Contenedor', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/OperadorTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/OperadorTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Domicilio; use CfdiUtils\Elements\CartaPorte10\Operador; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Operador */ final class OperadorTest extends TestCase { public Operador $element; protected function setUp(): void { parent::setUp(); $this->element = new Operador(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Operador', $this->element->getElementName()); } public function testGetDomicilio(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Domicilio')); $first = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $second = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $this->assertSame($first, $second); } public function testAddDomicilio(): void { // insert first element $first = $this->element->addDomicilio(['id' => 'first']); $this->assertInstanceOf(Domicilio::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addDomicilio(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/TransporteFerroviarioTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/TransporteFerroviarioTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Carro; use CfdiUtils\Elements\CartaPorte10\DerechosDePaso; use CfdiUtils\Elements\CartaPorte10\TransporteFerroviario; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\TransporteFerroviario */ final class TransporteFerroviarioTest extends TestCase { public TransporteFerroviario $element; protected function setUp(): void { parent::setUp(); $this->element = new TransporteFerroviario(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:TransporteFerroviario', $this->element->getElementName()); } public function testAddDerechosDePaso(): void { // insert first element $first = $this->element->addDerechosDePaso(['id' => 'first']); $this->assertInstanceOf(DerechosDePaso::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addDerechosDePaso(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiDerechosDePaso(): void { // insert first element $derechosDePaso = $this->element->multiDerechosDePaso( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $derechosDePaso); $this->assertSame($this->element, $derechosDePaso); } public function testAddCarro(): void { // insert first element $first = $this->element->addCarro(['id' => 'first']); $this->assertInstanceOf(Carro::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addCarro(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiCarro(): void { // insert first element $carros = $this->element->multiCarro( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $carros); $this->assertSame($this->element, $carros); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/PropietarioTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/PropietarioTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Domicilio; use CfdiUtils\Elements\CartaPorte10\Propietario; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Propietario */ final class PropietarioTest extends TestCase { public Propietario $element; protected function setUp(): void { parent::setUp(); $this->element = new Propietario(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Propietario', $this->element->getElementName()); } public function testGetDomicilio(): void { $this->assertCount(0, $this->element->searchNodes('cartaporte:Domicilio')); $first = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $second = $this->element->getDomicilio(); $this->assertCount(1, $this->element->searchNodes('cartaporte:Domicilio')); $this->assertSame($first, $second); } public function testAddDomicilio(): void { // insert first element $first = $this->element->addDomicilio(['id' => 'first']); $this->assertInstanceOf(Domicilio::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addDomicilio(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/TransporteAereoTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/TransporteAereoTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\TransporteAereo; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\TransporteAereo */ final class TransporteAereoTest extends TestCase { public TransporteAereo $element; protected function setUp(): void { parent::setUp(); $this->element = new TransporteAereo(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:TransporteAereo', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/DerechosDePasoTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/DerechosDePasoTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\DerechosDePaso; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\DerechosDePaso */ final class DerechosDePasoTest extends TestCase { public DerechosDePaso $element; protected function setUp(): void { parent::setUp(); $this->element = new DerechosDePaso(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:DerechosDePaso', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/DestinoTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/DestinoTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Destino; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Destino */ final class DestinoTest extends TestCase { public Destino $element; protected function setUp(): void { parent::setUp(); $this->element = new Destino(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Destino', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte10/RemolquesTest.php
tests/CfdiUtilsTests/Elements/CartaPorte10/RemolquesTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte10; use CfdiUtils\Elements\CartaPorte10\Remolque; use CfdiUtils\Elements\CartaPorte10\Remolques; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\CartaPorte10\Remolques */ final class RemolquesTest extends TestCase { public Remolques $element; protected function setUp(): void { parent::setUp(); $this->element = new Remolques(); } public function testConstructedObject(): void { $this->assertSame('cartaporte:Remolques', $this->element->getElementName()); } public function testAddRemolque(): void { // insert first element $first = $this->element->addRemolque(['id' => 'first']); $this->assertInstanceOf(Remolque::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addRemolque(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiRemolque(): void { // insert first element $remolque = $this->element->multiRemolque( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $remolque); $this->assertSame($this->element, $remolque); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones20/CfdiRetenRelacionadosTest.php
tests/CfdiUtilsTests/Elements/Retenciones20/CfdiRetenRelacionadosTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones20; use CfdiUtils\Elements\Retenciones20\CfdiRetenRelacionados; use PHPUnit\Framework\TestCase; final class CfdiRetenRelacionadosTest extends TestCase { public CfdiRetenRelacionados $element; public function setUp(): void { parent::setUp(); $this->element = new CfdiRetenRelacionados(); } public function testGetElementName(): void { $this->assertSame('retenciones:CfdiRetenRelacionados', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones20/RetencionesTest.php
tests/CfdiUtilsTests/Elements/Retenciones20/RetencionesTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones20; use CfdiUtils\Elements\Retenciones20\Addenda; use CfdiUtils\Elements\Retenciones20\CfdiRetenRelacionados; use CfdiUtils\Elements\Retenciones20\Complemento; use CfdiUtils\Elements\Retenciones20\Emisor; use CfdiUtils\Elements\Retenciones20\Extranjero; use CfdiUtils\Elements\Retenciones20\ImpRetenidos; use CfdiUtils\Elements\Retenciones20\Nacional; use CfdiUtils\Elements\Retenciones20\Periodo; use CfdiUtils\Elements\Retenciones20\Receptor; use CfdiUtils\Elements\Retenciones20\Retenciones; use CfdiUtils\Elements\Retenciones20\Totales; use CfdiUtils\Nodes\NodeInterface; use CfdiUtilsTests\Elements\ElementTestCase; final class RetencionesTest extends ElementTestCase { public function testRetenciones(): void { $element = new Retenciones(); $this->assertElementHasName($element, 'retenciones:Retenciones'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:retenciones' => 'http://www.sat.gob.mx/esquemas/retencionpago/2', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => vsprintf('%s %s', [ 'http://www.sat.gob.mx/esquemas/retencionpago/2', 'http://www.sat.gob.mx/esquemas/retencionpago/2/retencionpagov2.xsd', ]), 'Version' => '2.0', ]); $this->assertElementHasChildSingle($element, CfdiRetenRelacionados::class); $this->assertElementHasChildSingle($element, Emisor::class); $this->assertElementHasChildSingle($element, Receptor::class); $this->assertElementHasChildSingle($element, Periodo::class); $this->assertElementHasChildSingle($element, Totales::class); $this->assertElementHasChildSingleAddChild($element, Complemento::class); $this->assertElementHasChildSingleAddChild($element, Addenda::class); $this->assertElementHasOrder($element, [ 'retenciones:CfdiRetenRelacionados', 'retenciones:Emisor', 'retenciones:Receptor', 'retenciones:Periodo', 'retenciones:Totales', 'retenciones:Complemento', 'retenciones:Addenda', ]); } public function testCfdiRetenRelacionados(): void { $element = new CfdiRetenRelacionados(); $this->assertElementHasName($element, 'retenciones:CfdiRetenRelacionados'); } public function testEmisor(): void { $element = new Emisor(); $this->assertElementHasName($element, 'retenciones:Emisor'); } public function testReceptor(): void { $element = new Receptor(); $this->assertElementHasName($element, 'retenciones:Receptor'); $this->assertElementHasChildSingle($element, Nacional::class); $this->assertElementHasChildSingle($element, Extranjero::class); } public function testNacional(): void { $element = new Nacional(); $this->assertElementHasName($element, 'retenciones:Nacional'); } public function testExtranjero(): void { $element = new Extranjero(); $this->assertElementHasName($element, 'retenciones:Extranjero'); } public function testPeriodo(): void { $element = new Periodo(); $this->assertElementHasName($element, 'retenciones:Periodo'); } public function testTotales(): void { $element = new Totales(); $this->assertElementHasName($element, 'retenciones:Totales'); $this->assertElementHasChildMultiple($element, ImpRetenidos::class); } public function testImpRetenidos(): void { $element = new ImpRetenidos(); $this->assertElementHasName($element, 'retenciones:ImpRetenidos'); } public function testComplemento(): void { $element = new Complemento(); $this->assertElementHasName($element, 'retenciones:Complemento'); } public function testAddenda(): void { $element = new Addenda(); $this->assertElementHasName($element, 'retenciones:Addenda'); } public function testShortcutRetencionImpRetenidos(): void { $element = new Retenciones(); $first = $element->addImpRetenidos(['id' => '1']); $this->assertCount(1, $element->getTotales()->children()); $this->assertTrue($element->getTotales()->children()->exists($first)); $second = $element->addImpRetenidos(['id' => '2']); $this->assertCount(2, $element->getTotales()->children()); $this->assertTrue($element->getTotales()->children()->exists($second)); $this->assertSame( $element, $element->multiImpRetenidos(['id' => '3'], ['id' => '4']), 'Method Retenciones::multiImpRetenidos should return retenciones self instance' ); $this->assertCount(4, $element->getTotales()->children()); $this->assertSame( ['1', '2', '3', '4'], array_map( fn (NodeInterface $element): string => $element['id'], iterator_to_array($element->getTotales()->children()) ), 'All elements added should exists with expected values' ); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/IncapacidadesTest.php
tests/CfdiUtilsTests/Elements/Nomina12/IncapacidadesTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Incapacidad; use CfdiUtils\Elements\Nomina12\Incapacidades; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Incapacidades */ final class IncapacidadesTest extends TestCase { public Incapacidades $element; protected function setUp(): void { parent::setUp(); $this->element = new Incapacidades(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Incapacidades', $this->element->getElementName()); } public function testAddIncapacidad(): void { // insert first element $first = $this->element->addIncapacidad(['id' => 'first']); $this->assertInstanceOf(Incapacidad::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addIncapacidad(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiIncapacidad(): void { // insert first element $incapacidades = $this->element->multiIncapacidad( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $incapacidades); $this->assertSame($this->element, $incapacidades); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/HorasExtraTest.php
tests/CfdiUtilsTests/Elements/Nomina12/HorasExtraTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\HorasExtra; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\HorasExtra */ final class HorasExtraTest extends TestCase { public HorasExtra $element; protected function setUp(): void { parent::setUp(); $this->element = new HorasExtra(); } public function testConstructedObject(): void { $this->assertSame('nomina12:HorasExtra', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/PercepcionesTest.php
tests/CfdiUtilsTests/Elements/Nomina12/PercepcionesTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\JubilacionPensionRetiro; use CfdiUtils\Elements\Nomina12\Percepcion; use CfdiUtils\Elements\Nomina12\Percepciones; use CfdiUtils\Elements\Nomina12\SeparacionIndemnizacion; use CfdiUtils\Nodes\Node; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Percepciones */ final class PercepcionesTest extends TestCase { public Percepciones $element; protected function setUp(): void { parent::setUp(); $this->element = new Percepciones(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Percepciones', $this->element->getElementName()); } public function testChildrenOrder(): void { $expected = ['nomina12:Percepcion', 'nomina12:JubilacionPensionRetiro', 'nomina12:SeparacionIndemnizacion']; $this->assertSame($expected, $this->element->getChildrenOrder()); } public function testAddPercepcion(): void { // insert first element $children = [new Node('child-1'), new Node('child-2')]; $first = $this->element->addPercepcion(['id' => 'first'], $children); $this->assertInstanceOf(Percepcion::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); $this->assertTrue($first->children()->exists($children[0])); $this->assertTrue($first->children()->exists($children[1])); // insert second element data should return a different element $second = $this->element->addPercepcion(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiPercepcion(): void { $percepciones = $this->element->multiPercepcion( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $percepciones); $this->assertSame($this->element, $percepciones); } public function testGetJubilacionPensionRetiro(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:JubilacionPensionRetiro')); $first = $this->element->getJubilacionPensionRetiro(); $this->assertCount(1, $this->element->searchNodes('nomina12:JubilacionPensionRetiro')); $second = $this->element->getJubilacionPensionRetiro(); $this->assertCount(1, $this->element->searchNodes('nomina12:JubilacionPensionRetiro')); $this->assertSame($first, $second); } public function testAddJubilacionPensionRetiro(): void { // insert first element $first = $this->element->addJubilacionPensionRetiro(['id' => 'first']); $this->assertInstanceOf(JubilacionPensionRetiro::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addJubilacionPensionRetiro(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetSeparacionIndemnizacion(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:SeparacionIndemnizacion')); $first = $this->element->getSeparacionIndemnizacion(); $this->assertCount(1, $this->element->searchNodes('nomina12:SeparacionIndemnizacion')); $second = $this->element->getSeparacionIndemnizacion(); $this->assertCount(1, $this->element->searchNodes('nomina12:SeparacionIndemnizacion')); $this->assertSame($first, $second); } public function testAddSeparacionIndemnizacion(): void { // insert first element $first = $this->element->addSeparacionIndemnizacion(['id' => 'first']); $this->assertInstanceOf(SeparacionIndemnizacion::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addSeparacionIndemnizacion(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/AccionesOTitulosTest.php
tests/CfdiUtilsTests/Elements/Nomina12/AccionesOTitulosTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\AccionesOTitulos; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\AccionesOTitulos */ final class AccionesOTitulosTest extends TestCase { public AccionesOTitulos $element; protected function setUp(): void { parent::setUp(); $this->element = new AccionesOTitulos(); } public function testConstructedObject(): void { $this->assertSame('nomina12:AccionesOTitulos', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/IncapacidadTest.php
tests/CfdiUtilsTests/Elements/Nomina12/IncapacidadTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Incapacidad; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Incapacidad */ final class IncapacidadTest extends TestCase { public Incapacidad $element; protected function setUp(): void { parent::setUp(); $this->element = new Incapacidad(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Incapacidad', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/SeparacionIndemnizacionTest.php
tests/CfdiUtilsTests/Elements/Nomina12/SeparacionIndemnizacionTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\SeparacionIndemnizacion; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\SeparacionIndemnizacion */ final class SeparacionIndemnizacionTest extends TestCase { public SeparacionIndemnizacion $element; protected function setUp(): void { parent::setUp(); $this->element = new SeparacionIndemnizacion(); } public function testConstructedObject(): void { $this->assertSame('nomina12:SeparacionIndemnizacion', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/NominaTest.php
tests/CfdiUtilsTests/Elements/Nomina12/NominaTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Deducciones; use CfdiUtils\Elements\Nomina12\Emisor; use CfdiUtils\Elements\Nomina12\Incapacidades; use CfdiUtils\Elements\Nomina12\Nomina; use CfdiUtils\Elements\Nomina12\OtrosPagos; use CfdiUtils\Elements\Nomina12\Percepciones; use CfdiUtils\Elements\Nomina12\Receptor; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Nomina */ final class NominaTest extends TestCase { public Nomina $element; protected function setUp(): void { parent::setUp(); $this->element = new Nomina(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Nomina', $this->element->getElementName()); } public function testChildrenOrder(): void { $expected = [ 'nomina12:Emisor', 'nomina12:Receptor', 'nomina12:Percepciones', 'nomina12:Deducciones', 'nomina12:OtrosPagos', 'nomina12:Incapacidades', ]; $this->assertSame($expected, $this->element->getChildrenOrder()); } public function testFixedVersion(): void { $this->assertSame('1.2', $this->element['Version']); } public function testFixedNamespaceDefinition(): void { $namespace = 'http://www.sat.gob.mx/nomina12'; $this->assertSame($namespace, $this->element['xmlns:nomina12']); $xsdLocation = 'http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd'; $this->assertSame($namespace . ' ' . $xsdLocation, $this->element['xsi:schemaLocation']); } public function testGetEmisor(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:Emisor')); $first = $this->element->getEmisor(); $this->assertCount(1, $this->element->searchNodes('nomina12:Emisor')); $second = $this->element->getEmisor(); $this->assertCount(1, $this->element->searchNodes('nomina12:Emisor')); $this->assertSame($first, $second); } public function testAddEmisor(): void { // insert first element $first = $this->element->addEmisor(['id' => 'first']); $this->assertInstanceOf(Emisor::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addEmisor(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetReceptor(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:Receptor')); $first = $this->element->getReceptor(); $this->assertCount(1, $this->element->searchNodes('nomina12:Receptor')); $second = $this->element->getReceptor(); $this->assertCount(1, $this->element->searchNodes('nomina12:Receptor')); $this->assertSame($first, $second); } public function testAddReceptor(): void { // insert first element $first = $this->element->addReceptor(['id' => 'first']); $this->assertInstanceOf(Receptor::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addReceptor(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetPercepciones(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:Percepciones')); $first = $this->element->getPercepciones(); $this->assertCount(1, $this->element->searchNodes('nomina12:Percepciones')); $second = $this->element->getPercepciones(); $this->assertCount(1, $this->element->searchNodes('nomina12:Percepciones')); $this->assertSame($first, $second); } public function testAddPercepciones(): void { // insert first element $first = $this->element->addPercepciones(['id' => 'first']); $this->assertInstanceOf(Percepciones::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addPercepciones(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetDeducciones(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:Deducciones')); $first = $this->element->getDeducciones(); $this->assertCount(1, $this->element->searchNodes('nomina12:Deducciones')); $second = $this->element->getDeducciones(); $this->assertCount(1, $this->element->searchNodes('nomina12:Deducciones')); $this->assertSame($first, $second); } public function testAddDeducciones(): void { // insert first element $first = $this->element->addDeducciones(['id' => 'first']); $this->assertInstanceOf(Deducciones::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addDeducciones(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetOtrosPagos(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:OtrosPagos')); $first = $this->element->getOtrosPagos(); $this->assertCount(1, $this->element->searchNodes('nomina12:OtrosPagos')); $second = $this->element->getOtrosPagos(); $this->assertCount(1, $this->element->searchNodes('nomina12:OtrosPagos')); $this->assertSame($first, $second); } public function testAddOtrosPagos(): void { // insert first element $first = $this->element->addOtrosPagos(['id' => 'first']); $this->assertInstanceOf(OtrosPagos::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addOtrosPagos(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetIncapacidades(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:Incapacidades')); $first = $this->element->getIncapacidades(); $this->assertCount(1, $this->element->searchNodes('nomina12:Incapacidades')); $second = $this->element->getIncapacidades(); $this->assertCount(1, $this->element->searchNodes('nomina12:Incapacidades')); $this->assertSame($first, $second); } public function testAddIncapacidades(): void { // insert first element $first = $this->element->addIncapacidades(['id' => 'first']); $this->assertInstanceOf(Incapacidades::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addIncapacidades(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/OtrosPagosTest.php
tests/CfdiUtilsTests/Elements/Nomina12/OtrosPagosTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\OtroPago; use CfdiUtils\Elements\Nomina12\OtrosPagos; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\OtrosPagos */ final class OtrosPagosTest extends TestCase { public OtrosPagos $element; protected function setUp(): void { parent::setUp(); $this->element = new OtrosPagos(); } public function testConstructedObject(): void { $this->assertSame('nomina12:OtrosPagos', $this->element->getElementName()); } public function testAddOtrosPago(): void { // insert first element $first = $this->element->addOtrosPago(['id' => 'first']); $this->assertInstanceOf(OtroPago::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addOtrosPago(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiOtrosPago(): void { // insert first element $deducciones = $this->element->multiOtrosPago( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $deducciones); $this->assertSame($this->element, $deducciones); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/EmisorTest.php
tests/CfdiUtilsTests/Elements/Nomina12/EmisorTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Emisor; use CfdiUtils\Elements\Nomina12\EntidadSNCF; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Emisor */ final class EmisorTest extends TestCase { public Emisor $element; protected function setUp(): void { parent::setUp(); $this->element = new Emisor(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Emisor', $this->element->getElementName()); } public function testGetEntidadSNCF(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:EntidadSNCF')); $first = $this->element->getEntidadSNCF(); $this->assertCount(1, $this->element->searchNodes('nomina12:EntidadSNCF')); $second = $this->element->getEntidadSNCF(); $this->assertCount(1, $this->element->searchNodes('nomina12:EntidadSNCF')); $this->assertSame($first, $second); } public function testAddEntidadSNCF(): void { // insert first element $first = $this->element->addEntidadSNCF(['id' => 'first']); $this->assertInstanceOf(EntidadSNCF::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addEntidadSNCF(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/SubContratacionTest.php
tests/CfdiUtilsTests/Elements/Nomina12/SubContratacionTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\SubContratacion; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\SubContratacion */ final class SubContratacionTest extends TestCase { public SubContratacion $element; protected function setUp(): void { parent::setUp(); $this->element = new SubContratacion(); } public function testConstructedObject(): void { $this->assertSame('nomina12:SubContratacion', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/EntidadSNCFTest.php
tests/CfdiUtilsTests/Elements/Nomina12/EntidadSNCFTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\EntidadSNCF; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\EntidadSNCF */ final class EntidadSNCFTest extends TestCase { public EntidadSNCF $element; protected function setUp(): void { parent::setUp(); $this->element = new EntidadSNCF(); } public function testConstructedObject(): void { $this->assertSame('nomina12:EntidadSNCF', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/DeduccionTest.php
tests/CfdiUtilsTests/Elements/Nomina12/DeduccionTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Deduccion; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Deduccion */ final class DeduccionTest extends TestCase { public Deduccion $element; protected function setUp(): void { parent::setUp(); $this->element = new Deduccion(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Deduccion', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/DeduccionesTest.php
tests/CfdiUtilsTests/Elements/Nomina12/DeduccionesTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Deduccion; use CfdiUtils\Elements\Nomina12\Deducciones; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Deducciones */ final class DeduccionesTest extends TestCase { public Deducciones $element; protected function setUp(): void { parent::setUp(); $this->element = new Deducciones(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Deducciones', $this->element->getElementName()); } public function testAddDeduccion(): void { // insert first element $first = $this->element->addDeduccion(['id' => 'first']); $this->assertInstanceOf(Deduccion::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addDeduccion(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiDeduccion(): void { // insert first element $deducciones = $this->element->multiDeduccion( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $deducciones); $this->assertSame($this->element, $deducciones); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/PercepcionTest.php
tests/CfdiUtilsTests/Elements/Nomina12/PercepcionTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\AccionesOTitulos; use CfdiUtils\Elements\Nomina12\HorasExtra; use CfdiUtils\Elements\Nomina12\Percepcion; use CfdiUtils\Nodes\Node; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Percepcion */ final class PercepcionTest extends TestCase { public Percepcion $element; protected function setUp(): void { parent::setUp(); $this->element = new Percepcion(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Percepcion', $this->element->getElementName()); } public function testChildrenOrder(): void { $expected = ['nomina12:AccionesOTitulos', 'nomina12:HorasExtra']; $this->assertSame($expected, $this->element->getChildrenOrder()); } public function testGetAccionesOTitulos(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:AccionesOTitulos')); $first = $this->element->getAccionesOTitulos(); $this->assertCount(1, $this->element->searchNodes('nomina12:AccionesOTitulos')); $second = $this->element->getAccionesOTitulos(); $this->assertCount(1, $this->element->searchNodes('nomina12:AccionesOTitulos')); $this->assertSame($first, $second); } public function testAddAccionesOTitulos(): void { // insert first element $first = $this->element->addAccionesOTitulos(['id' => 'first']); $this->assertInstanceOf(AccionesOTitulos::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addAccionesOTitulos(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testAddHorasExtra(): void { // insert first element $children = [new Node('child-1'), new Node('child-2')]; $first = $this->element->addHorasExtra(['id' => 'first'], $children); $this->assertInstanceOf(HorasExtra::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); $this->assertTrue($first->children()->exists($children[0])); $this->assertTrue($first->children()->exists($children[1])); // insert second element data should return a different element $second = $this->element->addHorasExtra(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiHorasExtra(): void { $horasExtraes = $this->element->multiHorasExtra( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $horasExtraes); $this->assertSame($this->element, $horasExtraes); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/ReceptorTest.php
tests/CfdiUtilsTests/Elements/Nomina12/ReceptorTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\Receptor; use CfdiUtils\Elements\Nomina12\SubContratacion; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\Receptor */ final class ReceptorTest extends TestCase { public Receptor $element; protected function setUp(): void { parent::setUp(); $this->element = new Receptor(); } public function testConstructedObject(): void { $this->assertSame('nomina12:Receptor', $this->element->getElementName()); } public function testAddSubContratacion(): void { // insert first element $first = $this->element->addSubContratacion(['id' => 'first']); $this->assertInstanceOf(SubContratacion::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return a different element $second = $this->element->addSubContratacion(['id' => 'second']); $this->assertNotEquals($first, $second); $this->assertCount(2, $this->element); } public function testMultiSubContratacion(): void { // insert first element $receptor = $this->element->multiSubContratacion( ['id' => 'first'], ['id' => 'second'] ); $this->assertCount(2, $receptor); $this->assertSame($this->element, $receptor); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/JubilacionPensionRetiroTest.php
tests/CfdiUtilsTests/Elements/Nomina12/JubilacionPensionRetiroTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\JubilacionPensionRetiro; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\JubilacionPensionRetiro */ final class JubilacionPensionRetiroTest extends TestCase { public JubilacionPensionRetiro $element; protected function setUp(): void { parent::setUp(); $this->element = new JubilacionPensionRetiro(); } public function testConstructedObject(): void { $this->assertSame('nomina12:JubilacionPensionRetiro', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/OtroPagoTest.php
tests/CfdiUtilsTests/Elements/Nomina12/OtroPagoTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\CompensacionSaldosAFavor; use CfdiUtils\Elements\Nomina12\OtroPago; use CfdiUtils\Elements\Nomina12\SubsidioAlEmpleo; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\OtroPago */ final class OtroPagoTest extends TestCase { public OtroPago $element; protected function setUp(): void { parent::setUp(); $this->element = new OtroPago(); } public function testConstructedObject(): void { $this->assertSame('nomina12:OtroPago', $this->element->getElementName()); } public function testChildrenOrder(): void { $expected = ['nomina12:SubsidioAlEmpleo', 'nomina12:CompensacionSaldosAFavor']; $this->assertSame($expected, $this->element->getChildrenOrder()); } public function testGetSubsidioAlEmpleo(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:SubsidioAlEmpleo')); $first = $this->element->getSubsidioAlEmpleo(); $this->assertCount(1, $this->element->searchNodes('nomina12:SubsidioAlEmpleo')); $second = $this->element->getSubsidioAlEmpleo(); $this->assertCount(1, $this->element->searchNodes('nomina12:SubsidioAlEmpleo')); $this->assertSame($first, $second); } public function testAddSubsidioAlEmpleo(): void { // insert first element $first = $this->element->addSubsidioAlEmpleo(['id' => 'first']); $this->assertInstanceOf(SubsidioAlEmpleo::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addSubsidioAlEmpleo(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } public function testGetCompensacionSaldosAFavor(): void { $this->assertCount(0, $this->element->searchNodes('nomina12:CompensacionSaldosAFavor')); $first = $this->element->getCompensacionSaldosAFavor(); $this->assertCount(1, $this->element->searchNodes('nomina12:CompensacionSaldosAFavor')); $second = $this->element->getCompensacionSaldosAFavor(); $this->assertCount(1, $this->element->searchNodes('nomina12:CompensacionSaldosAFavor')); $this->assertSame($first, $second); } public function testAddCompensacionSaldosAFavor(): void { // insert first element $first = $this->element->addCompensacionSaldosAFavor(['id' => 'first']); $this->assertInstanceOf(CompensacionSaldosAFavor::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // insert second element data should return the same element $second = $this->element->addCompensacionSaldosAFavor(['id' => 'second']); $this->assertSame($first, $second); $this->assertSame('second', $first['id']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/SubsidioAlEmpleoTest.php
tests/CfdiUtilsTests/Elements/Nomina12/SubsidioAlEmpleoTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\SubsidioAlEmpleo; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\SubsidioAlEmpleo */ final class SubsidioAlEmpleoTest extends TestCase { public SubsidioAlEmpleo $element; protected function setUp(): void { parent::setUp(); $this->element = new SubsidioAlEmpleo(); } public function testConstructedObject(): void { $this->assertSame('nomina12:SubsidioAlEmpleo', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Nomina12/CompensacionSaldosAFavorTest.php
tests/CfdiUtilsTests/Elements/Nomina12/CompensacionSaldosAFavorTest.php
<?php namespace CfdiUtilsTests\Elements\Nomina12; use CfdiUtils\Elements\Nomina12\CompensacionSaldosAFavor; use PHPUnit\Framework\TestCase; /** * @covers \CfdiUtils\Elements\Nomina12\CompensacionSaldosAFavor */ final class CompensacionSaldosAFavorTest extends TestCase { public CompensacionSaldosAFavor $element; protected function setUp(): void { parent::setUp(); $this->element = new CompensacionSaldosAFavor(); } public function testConstructedObject(): void { $this->assertSame('nomina12:CompensacionSaldosAFavor', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte20/CartaPorteTest.php
tests/CfdiUtilsTests/Elements/CartaPorte20/CartaPorteTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte20; use CfdiUtils\Elements\CartaPorte20\Autotransporte; use CfdiUtils\Elements\CartaPorte20\CantidadTransporta; use CfdiUtils\Elements\CartaPorte20\Carro; use CfdiUtils\Elements\CartaPorte20\CartaPorte; use CfdiUtils\Elements\CartaPorte20\Contenedor; use CfdiUtils\Elements\CartaPorte20\DerechosDePaso; use CfdiUtils\Elements\CartaPorte20\DetalleMercancia; use CfdiUtils\Elements\CartaPorte20\Domicilio; use CfdiUtils\Elements\CartaPorte20\FiguraTransporte; use CfdiUtils\Elements\CartaPorte20\GuiasIdentificacion; use CfdiUtils\Elements\CartaPorte20\IdentificacionVehicular; use CfdiUtils\Elements\CartaPorte20\Mercancia; use CfdiUtils\Elements\CartaPorte20\Mercancias; use CfdiUtils\Elements\CartaPorte20\PartesTransporte; use CfdiUtils\Elements\CartaPorte20\Pedimentos; use CfdiUtils\Elements\CartaPorte20\Remolque; use CfdiUtils\Elements\CartaPorte20\Remolques; use CfdiUtils\Elements\CartaPorte20\Seguros; use CfdiUtils\Elements\CartaPorte20\TiposFigura; use CfdiUtils\Elements\CartaPorte20\TransporteAereo; use CfdiUtils\Elements\CartaPorte20\TransporteFerroviario; use CfdiUtils\Elements\CartaPorte20\TransporteMaritimo; use CfdiUtils\Elements\CartaPorte20\Ubicacion; use CfdiUtils\Elements\CartaPorte20\Ubicaciones; use CfdiUtilsTests\Elements\ElementTestCase; final class CartaPorteTest extends ElementTestCase { public function testCartaPorte(): void { $element = new CartaPorte(); $this->assertElementHasName($element, 'cartaporte20:CartaPorte'); $this->assertElementHasOrder($element, [ 'cartaporte20:Ubicaciones', 'cartaporte20:Mercancias', 'cartaporte20:FiguraTransporte', ]); $this->assertElementHasFixedAttributes($element, [ 'xmlns:cartaporte20' => 'http://www.sat.gob.mx/CartaPorte20', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/CartaPorte20' . ' http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte20.xsd', 'Version' => '2.0', ]); $this->assertElementHasChildSingle($element, Ubicaciones::class); $this->assertElementHasChildSingle($element, Mercancias::class); $this->assertElementHasChildSingle($element, FiguraTransporte::class); } public function testUbicaciones(): void { $element = new Ubicaciones(); $this->assertElementHasName($element, 'cartaporte20:Ubicaciones'); $this->assertElementHasChildMultiple($element, Ubicacion::class); } public function testMercancias(): void { $element = new Mercancias(); $this->assertElementHasName($element, 'cartaporte20:Mercancias'); $this->assertElementHasOrder($element, [ 'cartaporte20:Mercancia', 'cartaporte20:Autotransporte', 'cartaporte20:TransporteMaritimo', 'cartaporte20:TransporteAereo', 'cartaporte20:TransporteFerroviario', ]); $this->assertElementHasChildMultiple($element, Mercancia::class); $this->assertElementHasChildSingle($element, Autotransporte::class); $this->assertElementHasChildSingle($element, TransporteMaritimo::class); $this->assertElementHasChildSingle($element, TransporteAereo::class); $this->assertElementHasChildSingle($element, TransporteFerroviario::class); } public function testFiguraTransporte(): void { $element = new FiguraTransporte(); $this->assertElementHasName($element, 'cartaporte20:FiguraTransporte'); $this->assertElementHasChildMultiple($element, TiposFigura::class); } public function testUbicacion(): void { $element = new Ubicacion(); $this->assertElementHasName($element, 'cartaporte20:Ubicacion'); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testMercancia(): void { $element = new Mercancia(); $this->assertElementHasName($element, 'cartaporte20:Mercancia'); $this->assertElementHasOrder($element, [ 'cartaporte20:Pedimentos', 'cartaporte20:GuiasIdentificacion', 'cartaporte20:CantidadTransporta', 'cartaporte20:DetalleMercancia', ]); $this->assertElementHasChildMultiple($element, Pedimentos::class); $this->assertElementHasChildMultiple($element, GuiasIdentificacion::class); $this->assertElementHasChildMultiple($element, CantidadTransporta::class); $this->assertElementHasChildSingle($element, DetalleMercancia::class); } public function testAutotransporte(): void { $element = new Autotransporte(); $this->assertElementHasName($element, 'cartaporte20:Autotransporte'); $this->assertElementHasOrder($element, [ 'cartaporte20:IdentificacionVehicular', 'cartaporte20:Seguros', 'cartaporte20:Remolques', ]); $this->assertElementHasChildSingle($element, IdentificacionVehicular::class); $this->assertElementHasChildSingle($element, Seguros::class); $this->assertElementHasChildSingle($element, Remolques::class); } public function testTransporteMaritimo(): void { $element = new TransporteMaritimo(); $this->assertElementHasName($element, 'cartaporte20:TransporteMaritimo'); $this->assertElementHasChildMultiple($element, Contenedor::class); } public function testTransporteAereo(): void { $element = new TransporteAereo(); $this->assertElementHasName($element, 'cartaporte20:TransporteAereo'); } public function testTransporteFerroviario(): void { $element = new TransporteFerroviario(); $this->assertElementHasName($element, 'cartaporte20:TransporteFerroviario'); $this->assertElementHasOrder($element, [ 'cartaporte20:DerechosDePaso', 'cartaporte20:Carro', ]); $this->assertElementHasChildMultiple($element, DerechosDePaso::class); $this->assertElementHasChildMultiple($element, Carro::class); } public function testDomicilio(): void { $element = new Domicilio(); $this->assertElementHasName($element, 'cartaporte20:Domicilio'); } public function testTiposFigura(): void { $element = new TiposFigura(); $this->assertElementHasName($element, 'cartaporte20:TiposFigura'); $this->assertElementHasOrder($element, [ 'cartaporte20:PartesTransporte', 'cartaporte20:Domicilio', ]); $this->assertElementHasChildMultiple($element, PartesTransporte::class); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testPedimentos(): void { $element = new Pedimentos(); $this->assertElementHasName($element, 'cartaporte20:Pedimentos'); } public function testGuiasIdentificacion(): void { $element = new GuiasIdentificacion(); $this->assertElementHasName($element, 'cartaporte20:GuiasIdentificacion'); } public function testCantidadTransporta(): void { $element = new CantidadTransporta(); $this->assertElementHasName($element, 'cartaporte20:CantidadTransporta'); } public function testDetalleMercancia(): void { $element = new DetalleMercancia(); $this->assertElementHasName($element, 'cartaporte20:DetalleMercancia'); } public function testIdentificacionVehicular(): void { $element = new IdentificacionVehicular(); $this->assertElementHasName($element, 'cartaporte20:IdentificacionVehicular'); } public function testSeguros(): void { $element = new Seguros(); $this->assertElementHasName($element, 'cartaporte20:Seguros'); } public function testRemolques(): void { $element = new Remolques(); $this->assertElementHasName($element, 'cartaporte20:Remolques'); $this->assertElementHasChildMultiple($element, Remolque::class); } public function testContenedor(): void { $element = new Contenedor(); $this->assertElementHasName($element, 'cartaporte20:Contenedor'); } public function testDerechosDePaso(): void { $element = new DerechosDePaso(); $this->assertElementHasName($element, 'cartaporte20:DerechosDePaso'); } public function testCarro(): void { $element = new Carro(); $this->assertElementHasName($element, 'cartaporte20:Carro'); $this->assertElementHasChildMultiple($element, Contenedor::class); } public function testPartesTransporte(): void { $element = new PartesTransporte(); $this->assertElementHasName($element, 'cartaporte20:PartesTransporte'); } public function testRemolque(): void { $element = new Remolque(); $this->assertElementHasName($element, 'cartaporte20:Remolque'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Cce20/ComercioExteriorTest.php
tests/CfdiUtilsTests/Elements/Cce20/ComercioExteriorTest.php
<?php namespace CfdiUtilsTests\Elements\Cce20; use CfdiUtils\Elements\Cce20\ComercioExterior; use CfdiUtils\Elements\Cce20\DescripcionesEspecificas; use CfdiUtils\Elements\Cce20\Destinatario; use CfdiUtils\Elements\Cce20\Domicilio; use CfdiUtils\Elements\Cce20\Emisor; use CfdiUtils\Elements\Cce20\Mercancia; use CfdiUtils\Elements\Cce20\Mercancias; use CfdiUtils\Elements\Cce20\Propietario; use CfdiUtils\Elements\Cce20\Receptor; use CfdiUtilsTests\Elements\ElementTestCase; final class ComercioExteriorTest extends ElementTestCase { public function testComercioExterior(): void { $element = new ComercioExterior(); $this->assertElementHasName($element, 'cce20:ComercioExterior'); $this->assertElementHasOrder($element, [ 'cce20:Emisor', 'cce20:Propietario', 'cce20:Receptor', 'cce20:Destinatario', 'cce20:Mercancias', ]); $this->assertElementHasFixedAttributes($element, [ 'xmlns:cce20' => 'http://www.sat.gob.mx/ComercioExterior20', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/ComercioExterior20' . ' http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior20/ComercioExterior20.xsd', 'Version' => '2.0', ]); $this->assertElementHasChildSingle($element, Emisor::class); $this->assertElementHasChildMultiple($element, Propietario::class); $this->assertElementHasChildSingle($element, Receptor::class); $this->assertElementHasChildMultiple($element, Destinatario::class); $this->assertElementHasChildSingle($element, Mercancias::class); } public function testEmisor(): void { $element = new Emisor(); $this->assertElementHasName($element, 'cce20:Emisor'); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testDomicilio(): void { $element = new Domicilio(); $this->assertElementHasName($element, 'cce20:Domicilio'); } public function testPropietario(): void { $element = new Propietario(); $this->assertElementHasName($element, 'cce20:Propietario'); } public function testReceptor(): void { $element = new Receptor(); $this->assertElementHasName($element, 'cce20:Receptor'); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testDestinatario(): void { $element = new Destinatario(); $this->assertElementHasName($element, 'cce20:Destinatario'); $this->assertElementHasChildMultiple($element, Domicilio::class); } public function testMercancias(): void { $element = new Mercancias(); $this->assertElementHasName($element, 'cce20:Mercancias'); $this->assertElementHasChildMultiple($element, Mercancia::class); } public function testMercancia(): void { $element = new Mercancia(); $this->assertElementHasName($element, 'cce20:Mercancia'); $this->assertElementHasChildMultiple($element, DescripcionesEspecificas::class); } public function testDescripcionesEspecificas(): void { $element = new DescripcionesEspecificas(); $this->assertElementHasName($element, 'cce20:DescripcionesEspecificas'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/LeyendasFiscales10/LeyendasFiscalesTest.php
tests/CfdiUtilsTests/Elements/LeyendasFiscales10/LeyendasFiscalesTest.php
<?php namespace CfdiUtilsTests\Elements\LeyendasFiscales10; use CfdiUtils\Elements\LeyendasFiscales10\Leyenda; use CfdiUtils\Elements\LeyendasFiscales10\LeyendasFiscales; use CfdiUtilsTests\Elements\ElementTestCase; final class LeyendasFiscalesTest extends ElementTestCase { public function testLeyendasFiscales(): void { $element = new LeyendasFiscales(); $this->assertElementHasName($element, 'leyendasFisc:LeyendasFiscales'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:leyendasFisc' => 'http://www.sat.gob.mx/leyendasFiscales', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/leyendasFiscales' . ' http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xsd', 'version' => '1.0', ]); $this->assertElementHasChildMultiple($element, Leyenda::class); } public function testLeyenda(): void { $element = new Leyenda(); $this->assertElementHasName($element, 'leyendasFisc:Leyenda'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte31/CartaPorteTest.php
tests/CfdiUtilsTests/Elements/CartaPorte31/CartaPorteTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte31; use CfdiUtils\Elements\CartaPorte31\Autotransporte; use CfdiUtils\Elements\CartaPorte31\CantidadTransporta; use CfdiUtils\Elements\CartaPorte31\Carro; use CfdiUtils\Elements\CartaPorte31\CartaPorte; use CfdiUtils\Elements\CartaPorte31\ContenedorFerroviario; use CfdiUtils\Elements\CartaPorte31\ContenedorMaritimo; use CfdiUtils\Elements\CartaPorte31\DerechosDePaso; use CfdiUtils\Elements\CartaPorte31\DetalleMercancia; use CfdiUtils\Elements\CartaPorte31\DocumentacionAduanera; use CfdiUtils\Elements\CartaPorte31\Domicilio; use CfdiUtils\Elements\CartaPorte31\FiguraTransporte; use CfdiUtils\Elements\CartaPorte31\GuiasIdentificacion; use CfdiUtils\Elements\CartaPorte31\IdentificacionVehicular; use CfdiUtils\Elements\CartaPorte31\Mercancia; use CfdiUtils\Elements\CartaPorte31\Mercancias; use CfdiUtils\Elements\CartaPorte31\PartesTransporte; use CfdiUtils\Elements\CartaPorte31\RegimenAduaneroCCP; use CfdiUtils\Elements\CartaPorte31\RegimenesAduaneros; use CfdiUtils\Elements\CartaPorte31\Remolque; use CfdiUtils\Elements\CartaPorte31\RemolqueCCP; use CfdiUtils\Elements\CartaPorte31\Remolques; use CfdiUtils\Elements\CartaPorte31\RemolquesCCP; use CfdiUtils\Elements\CartaPorte31\Seguros; use CfdiUtils\Elements\CartaPorte31\TiposFigura; use CfdiUtils\Elements\CartaPorte31\TransporteAereo; use CfdiUtils\Elements\CartaPorte31\TransporteFerroviario; use CfdiUtils\Elements\CartaPorte31\TransporteMaritimo; use CfdiUtils\Elements\CartaPorte31\Ubicacion; use CfdiUtils\Elements\CartaPorte31\Ubicaciones; use CfdiUtilsTests\Elements\ElementTestCase; final class CartaPorteTest extends ElementTestCase { public function testCartaPorte(): void { $element = new CartaPorte(); $this->assertElementHasName($element, 'cartaporte31:CartaPorte'); $this->assertElementHasOrder($element, [ 'cartaporte31:RegimenesAduaneros', 'cartaporte31:Ubicaciones', 'cartaporte31:Mercancias', 'cartaporte31:FiguraTransporte', ]); $this->assertElementHasFixedAttributes($element, [ 'xmlns:cartaporte31' => 'http://www.sat.gob.mx/CartaPorte31', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/CartaPorte31' . ' http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte31.xsd', 'Version' => '3.1', ]); $this->assertElementHasChildSingle($element, Ubicaciones::class); $this->assertElementHasChildSingle($element, Mercancias::class); $this->assertElementHasChildSingle($element, FiguraTransporte::class); } public function testRegimenesAduaneros(): void { $element = new RegimenesAduaneros(); $this->assertElementHasName($element, 'cartaporte31:RegimenesAduaneros'); $this->assertElementHasChildMultiple($element, RegimenAduaneroCCP::class); } public function testRegimenAduaneroCCP(): void { $element = new RegimenAduaneroCCP(); $this->assertElementHasName($element, 'cartaporte31:RegimenAduaneroCCP'); } public function testUbicaciones(): void { $element = new Ubicaciones(); $this->assertElementHasName($element, 'cartaporte31:Ubicaciones'); $this->assertElementHasChildMultiple($element, Ubicacion::class); } public function testUbicacion(): void { $element = new Ubicacion(); $this->assertElementHasName($element, 'cartaporte31:Ubicacion'); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testDomicilio(): void { $element = new Domicilio(); $this->assertElementHasName($element, 'cartaporte31:Domicilio'); } public function testMercancias(): void { $element = new Mercancias(); $this->assertElementHasName($element, 'cartaporte31:Mercancias'); $this->assertElementHasOrder($element, [ 'cartaporte31:Mercancia', 'cartaporte31:Autotransporte', 'cartaporte31:TransporteMaritimo', 'cartaporte31:TransporteAereo', 'cartaporte31:TransporteFerroviario', ]); $this->assertElementHasChildMultiple($element, Mercancia::class); $this->assertElementHasChildSingle($element, Autotransporte::class); $this->assertElementHasChildSingle($element, TransporteMaritimo::class); $this->assertElementHasChildSingle($element, TransporteAereo::class); $this->assertElementHasChildSingle($element, TransporteFerroviario::class); } public function testMercancia(): void { $element = new Mercancia(); $this->assertElementHasName($element, 'cartaporte31:Mercancia'); $this->assertElementHasOrder($element, [ 'cartaporte31:DocumentacionAduanera', 'cartaporte31:GuiasIdentificacion', 'cartaporte31:CantidadTransporta', 'cartaporte31:DetalleMercancia', ]); $this->assertElementHasChildMultiple($element, DocumentacionAduanera::class); $this->assertElementHasChildMultiple($element, GuiasIdentificacion::class); $this->assertElementHasChildMultiple($element, CantidadTransporta::class); $this->assertElementHasChildSingle($element, DetalleMercancia::class); } public function testDocumentacionAduanera(): void { $element = new DocumentacionAduanera(); $this->assertElementHasName($element, 'cartaporte31:DocumentacionAduanera'); } public function testGuiasIdentificacion(): void { $element = new GuiasIdentificacion(); $this->assertElementHasName($element, 'cartaporte31:GuiasIdentificacion'); } public function testCantidadTransporta(): void { $element = new CantidadTransporta(); $this->assertElementHasName($element, 'cartaporte31:CantidadTransporta'); } public function testDetalleMercancia(): void { $element = new DetalleMercancia(); $this->assertElementHasName($element, 'cartaporte31:DetalleMercancia'); } public function testAutotransporte(): void { $element = new Autotransporte(); $this->assertElementHasName($element, 'cartaporte31:Autotransporte'); $this->assertElementHasOrder($element, [ 'cartaporte31:IdentificacionVehicular', 'cartaporte31:Seguros', 'cartaporte31:Remolques', ]); $this->assertElementHasChildSingle($element, IdentificacionVehicular::class); $this->assertElementHasChildSingle($element, Seguros::class); $this->assertElementHasChildSingle($element, Remolques::class); } public function testIdentificacionVehicular(): void { $element = new IdentificacionVehicular(); $this->assertElementHasName($element, 'cartaporte31:IdentificacionVehicular'); } public function testSeguros(): void { $element = new Seguros(); $this->assertElementHasName($element, 'cartaporte31:Seguros'); } public function testRemolques(): void { $element = new Remolques(); $this->assertElementHasName($element, 'cartaporte31:Remolques'); $this->assertElementHasChildMultiple($element, Remolque::class); } public function testRemolque(): void { $element = new Remolque(); $this->assertElementHasName($element, 'cartaporte31:Remolque'); } public function testTransporteMaritimo(): void { $element = new TransporteMaritimo(); $this->assertElementHasName($element, 'cartaporte31:TransporteMaritimo'); $this->assertElementHasChildMultiple($element, ContenedorMaritimo::class, 'Contenedor'); } public function testContenedorMaritimo(): void { $element = new ContenedorMaritimo(); $this->assertElementHasName($element, 'cartaporte31:Contenedor'); $this->assertElementHasChildSingle($element, RemolquesCCP::class); } public function testRemolquesCPP(): void { $element = new RemolquesCCP(); $this->assertElementHasName($element, 'cartaporte31:RemolquesCCP'); $this->assertElementHasChildMultiple($element, RemolqueCCP::class); } public function testRemolqueCPP(): void { $element = new RemolqueCCP(); $this->assertElementHasName($element, 'cartaporte31:RemolqueCCP'); } public function testTransporteAereo(): void { $element = new TransporteAereo(); $this->assertElementHasName($element, 'cartaporte31:TransporteAereo'); } public function testTransporteFerroviario(): void { $element = new TransporteFerroviario(); $this->assertElementHasName($element, 'cartaporte31:TransporteFerroviario'); $this->assertElementHasOrder($element, [ 'cartaporte31:DerechosDePaso', 'cartaporte31:Carro', ]); $this->assertElementHasChildMultiple($element, DerechosDePaso::class); $this->assertElementHasChildMultiple($element, Carro::class); } public function testDerechosDePaso(): void { $element = new DerechosDePaso(); $this->assertElementHasName($element, 'cartaporte31:DerechosDePaso'); } public function testCarro(): void { $element = new Carro(); $this->assertElementHasName($element, 'cartaporte31:Carro'); $this->assertElementHasChildMultiple($element, ContenedorFerroviario::class, 'Contenedor'); } public function testContenedorFerroviario(): void { $element = new ContenedorFerroviario(); $this->assertElementHasName($element, 'cartaporte31:Contenedor'); } public function testFiguraTransporte(): void { $element = new FiguraTransporte(); $this->assertElementHasName($element, 'cartaporte31:FiguraTransporte'); $this->assertElementHasChildMultiple($element, TiposFigura::class); } public function testTiposFigura(): void { $element = new TiposFigura(); $this->assertElementHasName($element, 'cartaporte31:TiposFigura'); $this->assertElementHasOrder($element, [ 'cartaporte31:PartesTransporte', 'cartaporte31:Domicilio', ]); $this->assertElementHasChildMultiple($element, PartesTransporte::class); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testPartesTransporte(): void { $element = new PartesTransporte(); $this->assertElementHasName($element, 'cartaporte31:PartesTransporte'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Pagos20/Pagos20Test.php
tests/CfdiUtilsTests/Elements/Pagos20/Pagos20Test.php
<?php namespace CfdiUtilsTests\Elements\Pagos20; use CfdiUtils\Elements\Pagos20\DoctoRelacionado; use CfdiUtils\Elements\Pagos20\ImpuestosDR; use CfdiUtils\Elements\Pagos20\ImpuestosP; use CfdiUtils\Elements\Pagos20\Pago; use CfdiUtils\Elements\Pagos20\Pagos; use CfdiUtils\Elements\Pagos20\RetencionDR; use CfdiUtils\Elements\Pagos20\RetencionesDR; use CfdiUtils\Elements\Pagos20\RetencionesP; use CfdiUtils\Elements\Pagos20\RetencionP; use CfdiUtils\Elements\Pagos20\Totales; use CfdiUtils\Elements\Pagos20\TrasladoDR; use CfdiUtils\Elements\Pagos20\TrasladoP; use CfdiUtils\Elements\Pagos20\TrasladosDR; use CfdiUtils\Elements\Pagos20\TrasladosP; use CfdiUtilsTests\Elements\ElementTestCase; final class Pagos20Test extends ElementTestCase { public function testPagos(): void { $element = new Pagos(); $this->assertElementHasName($element, 'pago20:Pagos'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:pago20' => 'http://www.sat.gob.mx/Pagos20', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/Pagos20' . ' http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos20.xsd', 'Version' => '2.0', ]); $this->assertElementHasChildSingle($element, Totales::class); $this->assertElementHasChildMultiple($element, Pago::class); } public function testTotales(): void { $element = new Totales(); $this->assertElementHasName($element, 'pago20:Totales'); } public function testPago(): void { $element = new Pago(); $this->assertElementHasName($element, 'pago20:Pago'); $this->assertElementHasOrder($element, [ 'pago20:DoctoRelacionado', 'pago20:ImpuestosP', ]); $this->assertElementHasChildMultiple($element, DoctoRelacionado::class); $this->assertElementHasChildSingle($element, ImpuestosP::class); } public function testDoctoRelacionado(): void { $element = new DoctoRelacionado(); $this->assertElementHasName($element, 'pago20:DoctoRelacionado'); $this->assertElementHasChildSingle($element, ImpuestosDR::class); } public function testImpuestosDR(): void { $element = new ImpuestosDR(); $this->assertElementHasName($element, 'pago20:ImpuestosDR'); $this->assertElementHasOrder($element, [ 'pago20:RetencionesDR', 'pago20:TrasladosDR', ]); $this->assertElementHasChildSingle($element, RetencionesDR::class); $this->assertElementHasChildSingle($element, TrasladosDR::class); } public function testRetencionesDR(): void { $element = new RetencionesDR(); $this->assertElementHasName($element, 'pago20:RetencionesDR'); $this->assertElementHasChildMultiple($element, RetencionDR::class); } public function testRetencionDR(): void { $element = new RetencionDR(); $this->assertElementHasName($element, 'pago20:RetencionDR'); } public function testTrasladosDR(): void { $element = new TrasladosDR(); $this->assertElementHasName($element, 'pago20:TrasladosDR'); $this->assertElementHasChildMultiple($element, TrasladoDR::class); } public function testTrasladoDR(): void { $element = new TrasladoDR(); $this->assertElementHasName($element, 'pago20:TrasladoDR'); } public function testImpuestosP(): void { $element = new ImpuestosP(); $this->assertElementHasName($element, 'pago20:ImpuestosP'); $this->assertElementHasOrder($element, [ 'pago20:RetencionesP', 'pago20:TrasladosP', ]); $this->assertElementHasChildSingle($element, RetencionesP::class); $this->assertElementHasChildSingle($element, TrasladosP::class); } public function testRetencionesP(): void { $element = new RetencionesP(); $this->assertElementHasName($element, 'pago20:RetencionesP'); $this->assertElementHasChildMultiple($element, RetencionP::class); } public function testRetencionP(): void { $element = new RetencionP(); $this->assertElementHasName($element, 'pago20:RetencionP'); } public function testTrasladosP(): void { $element = new TrasladosP(); $this->assertElementHasName($element, 'pago20:TrasladosP'); $this->assertElementHasChildMultiple($element, TrasladoP::class); } public function testTrasladoP(): void { $element = new TrasladoP(); $this->assertElementHasName($element, 'pago20:TrasladoP'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/AddendaTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/AddendaTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\Addenda; use CfdiUtils\Nodes\Node; use PHPUnit\Framework\TestCase; final class AddendaTest extends TestCase { public Addenda $element; public function setUp(): void { parent::setUp(); $this->element = new Addenda(); } public function testGetElementName(): void { $this->assertSame('retenciones:Addenda', $this->element->getElementName()); } public function testAdd(): void { $this->assertCount(0, $this->element); $firstChild = new Node('first'); $addReturn = $this->element->add($firstChild); $this->assertSame($this->element, $addReturn); $this->assertCount(1, $this->element); $this->assertSame($firstChild, $this->element->searchNode('first')); $secondChild = new Node('second'); $this->element->add($secondChild); $this->assertCount(2, $this->element); $this->assertSame($secondChild, $this->element->searchNode('second')); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/ComplementoTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/ComplementoTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\Complemento; use CfdiUtils\Nodes\Node; use PHPUnit\Framework\TestCase; final class ComplementoTest extends TestCase { public Complemento $element; public function setUp(): void { parent::setUp(); $this->element = new Complemento(); } public function testGetElementName(): void { $this->assertSame('retenciones:Complemento', $this->element->getElementName()); } public function testAdd(): void { $this->assertCount(0, $this->element); $firstChild = new Node('first'); $addReturn = $this->element->add($firstChild); $this->assertSame($this->element, $addReturn); $this->assertCount(1, $this->element); $this->assertSame($firstChild, $this->element->searchNode('first')); $secondChild = new Node('second'); $this->element->add($secondChild); $this->assertCount(2, $this->element); $this->assertSame($secondChild, $this->element->searchNode('second')); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/PeriodoTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/PeriodoTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\Periodo; use PHPUnit\Framework\TestCase; final class PeriodoTest extends TestCase { public Periodo $element; public function setUp(): void { parent::setUp(); $this->element = new Periodo(); } public function testGetElementName(): void { $this->assertSame('retenciones:Periodo', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/EmisorTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/EmisorTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\Emisor; use PHPUnit\Framework\TestCase; final class EmisorTest extends TestCase { public Emisor $element; public function setUp(): void { parent::setUp(); $this->element = new Emisor(); } public function testGetElementName(): void { $this->assertSame('retenciones:Emisor', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/ReceptorTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/ReceptorTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\Extranjero; use CfdiUtils\Elements\Retenciones10\Nacional; use CfdiUtils\Elements\Retenciones10\Receptor; use PHPUnit\Framework\TestCase; final class ReceptorTest extends TestCase { public Receptor $element; protected function setUp(): void { parent::setUp(); $this->element = new Receptor(); } public function testGetElementName(): void { $this->assertSame('retenciones:Receptor', $this->element->getElementName()); } public function testGetNacionalOverridesGetExtranjeroAndViceversa(): void { $this->element->getExtranjero(); $this->element->getNacional(); $this->assertCount(1, $this->element); $this->assertSame('Nacional', $this->element['Nacionalidad']); $this->element->getExtranjero(); $this->assertCount(1, $this->element); $this->assertSame('Extranjero', $this->element['Nacionalidad']); } public function testAddNacional(): void { $first = $this->element->addNacional(['foo' => 'ZOO']); $this->assertInstanceOf(Nacional::class, $first); $this->assertSame('ZOO', $first['foo']); $second = $this->element->addNacional(['foo' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['foo']); $this->assertCount(1, $this->element); $this->assertSame('Nacional', $this->element['Nacionalidad']); } public function testAddExtranjero(): void { $first = $this->element->addExtranjero(['foo' => 'ZOO']); $this->assertInstanceOf(Extranjero::class, $first); $this->assertSame('ZOO', $first['foo']); $second = $this->element->addExtranjero(['foo' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['foo']); $this->assertCount(1, $this->element); $this->assertSame('Extranjero', $this->element['Nacionalidad']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/RetencionesTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/RetencionesTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\Addenda; use CfdiUtils\Elements\Retenciones10\Complemento; use CfdiUtils\Elements\Retenciones10\Emisor; use CfdiUtils\Elements\Retenciones10\ImpRetenidos; use CfdiUtils\Elements\Retenciones10\Periodo; use CfdiUtils\Elements\Retenciones10\Receptor; use CfdiUtils\Elements\Retenciones10\Retenciones; use CfdiUtils\Elements\Retenciones10\Totales; use CfdiUtils\Nodes\Node; use PHPUnit\Framework\TestCase; final class RetencionesTest extends TestCase { public Retenciones $element; protected function setUp(): void { parent::setUp(); $this->element = new Retenciones(); } public function testGetElementName(): void { $this->assertSame('retenciones:Retenciones', $this->element->getElementName()); } public function testGetEmisor(): void { $this->assertNull($this->element->searchNode('retenciones:Emisor')); $child = $this->element->getEmisor(); $this->assertInstanceOf(Emisor::class, $child); $this->assertSame($child, $this->element->searchNode('retenciones:Emisor')); } public function testAddEmisor(): void { $first = $this->element->addEmisor(['Rfc' => 'FOO']); $this->assertInstanceOf(Emisor::class, $first); $this->assertSame('FOO', $first['Rfc']); $second = $this->element->addEmisor(['Rfc' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['Rfc']); } public function testGetReceptor(): void { $this->assertNull($this->element->searchNode('retenciones:Receptor')); $child = $this->element->getReceptor(); $this->assertInstanceOf(Receptor::class, $child); $this->assertSame($child, $this->element->searchNode('retenciones:Receptor')); } public function testAddReceptor(): void { $first = $this->element->addReceptor(['Rfc' => 'BAZ']); $this->assertInstanceOf(Receptor::class, $first); $this->assertSame('BAZ', $first['Rfc']); $second = $this->element->addReceptor(['Rfc' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['Rfc']); } public function testGetPeriodo(): void { $this->assertNull($this->element->searchNode('retenciones:Periodo')); $child = $this->element->getPeriodo(); $this->assertInstanceOf(Periodo::class, $child); $this->assertSame($child, $this->element->searchNode('retenciones:Periodo')); } public function testAddPeriodo(): void { $first = $this->element->addPeriodo(['Rfc' => 'BAZ']); $this->assertInstanceOf(Periodo::class, $first); $this->assertSame('BAZ', $first['Rfc']); $second = $this->element->addPeriodo(['Rfc' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['Rfc']); } public function testGetTotales(): void { $this->assertNull($this->element->searchNode('retenciones:Totales')); $child = $this->element->getTotales(); $this->assertInstanceOf(Totales::class, $child); $this->assertSame($child, $this->element->searchNode('retenciones:Totales')); } public function testAddTotales(): void { $first = $this->element->addTotales(['Foo' => 'Bar']); $this->assertInstanceOf(Totales::class, $first); $this->assertSame('Bar', $first['Foo']); $second = $this->element->addTotales(['Foo' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['Foo']); } public function testAddImpRetenidos(): void { $first = $this->element->addImpRetenidos(['UUID' => 'FOO']); $this->assertInstanceOf(ImpRetenidos::class, $first); $this->assertSame('FOO', $first['UUID']); $this->assertCount(1, $this->element->getTotales()); } public function testMultiImpRetenidos(): void { $self = $this->element->multiImpRetenidos( ['UUID' => 'FOO'], ['UUID' => 'BAR'] ); $this->assertSame($this->element, $self); $parent = $this->element->getTotales(); $this->assertCount(2, $parent); $this->assertSame('FOO', $parent->children()->get(0)['UUID']); $this->assertSame('BAR', $parent->children()->get(1)['UUID']); } public function testGetComplemento(): void { $this->assertNull($this->element->searchNode('retenciones:Complemento')); $child = $this->element->getComplemento(); $this->assertInstanceOf(Complemento::class, $child); $this->assertSame($child, $this->element->searchNode('retenciones:Complemento')); } public function testAddComplemento(): void { $this->assertCount(0, $this->element); $child = new Node('first'); $addReturn = $this->element->addComplemento($child); $this->assertCount(1, $this->element); $this->assertSame($child, $this->element->searchNode('retenciones:Complemento', 'first')); $this->assertSame($addReturn, $this->element); } public function testGetAddenda(): void { $this->assertNull($this->element->searchNode('retenciones:Addenda')); $child = $this->element->getAddenda(); $this->assertInstanceOf(Addenda::class, $child); $this->assertSame($child, $this->element->searchNode('retenciones:Addenda')); } public function testAddAddenda(): void { $this->assertCount(0, $this->element); $child = new Node('first'); $addReturn = $this->element->addAddenda($child); $this->assertCount(1, $this->element); $this->assertSame($child, $this->element->searchNode('retenciones:Addenda', 'first')); $this->assertSame($addReturn, $this->element); } public function testHasFixedAttributes(): void { $namespace = 'http://www.sat.gob.mx/esquemas/retencionpago/1'; $this->assertSame('1.0', $this->element['Version']); $this->assertSame($namespace, $this->element['xmlns:retenciones']); $this->assertStringStartsWith($namespace . ' http://', $this->element['xsi:schemaLocation']); $this->assertNotEmpty($this->element['xmlns:xsi']); } public function testChildrenOrder(): void { // add in inverse order $this->element->getAddenda(); $this->element->getComplemento(); $this->element->getTotales(); $this->element->getPeriodo(); $this->element->getReceptor(); $this->element->getEmisor(); // retrieve in correct order $this->assertInstanceOf(Emisor::class, $this->element->children()->get(0)); $this->assertInstanceOf(Receptor::class, $this->element->children()->get(1)); $this->assertInstanceOf(Periodo::class, $this->element->children()->get(2)); $this->assertInstanceOf(Totales::class, $this->element->children()->get(3)); $this->assertInstanceOf(Complemento::class, $this->element->children()->get(4)); $this->assertInstanceOf(Addenda::class, $this->element->children()->get(5)); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Retenciones10/TotalesTest.php
tests/CfdiUtilsTests/Elements/Retenciones10/TotalesTest.php
<?php namespace CfdiUtilsTests\Elements\Retenciones10; use CfdiUtils\Elements\Retenciones10\ImpRetenidos; use CfdiUtils\Elements\Retenciones10\Totales; use PHPUnit\Framework\TestCase; final class TotalesTest extends TestCase { public Totales $element; protected function setUp(): void { parent::setUp(); $this->element = new Totales(); } public function testGetElementName(): void { $this->assertSame('retenciones:Totales', $this->element->getElementName()); } public function testAddCfdiRelacionado(): void { // no childs $this->assertCount(0, $this->element); // add first child $first = $this->element->addImpRetenidos(['name' => 'first']); $this->assertInstanceOf(ImpRetenidos::class, $first); $this->assertSame('first', $first['name']); $this->assertCount(1, $this->element); // add second child $second = $this->element->addImpRetenidos(); $this->assertCount(2, $this->element); // test that first and second are not the same $this->assertNotSame($first, $second); } public function testAddImpRetenidos(): void { $first = $this->element->addImpRetenidos(['var' => 'FOO']); $this->assertInstanceOf(ImpRetenidos::class, $first); $this->assertSame('FOO', $first['var']); $this->assertCount(1, $this->element); } public function testMultiImpRetenidos(): void { $self = $this->element->multiImpRetenidos( ['var' => 'FOO'], ['var' => 'BAR'] ); $this->assertSame($this->element, $self); $this->assertCount(2, $this->element); $this->assertSame('FOO', $this->element->children()->get(0)['var']); $this->assertSame('BAR', $this->element->children()->get(1)['var']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/PagosAExtranjeros10/PagosaextranjerosTest.php
tests/CfdiUtilsTests/Elements/PagosAExtranjeros10/PagosaextranjerosTest.php
<?php namespace CfdiUtilsTests\Elements\PagosAExtranjeros10; use CfdiUtils\Elements\PagosAExtranjeros10\Beneficiario; use CfdiUtils\Elements\PagosAExtranjeros10\NoBeneficiario; use CfdiUtils\Elements\PagosAExtranjeros10\Pagosaextranjeros; use PHPUnit\Framework\TestCase; final class PagosaextranjerosTest extends TestCase { public Pagosaextranjeros $element; protected function setUp(): void { parent::setUp(); $this->element = new Pagosaextranjeros(); } public function testGetElementName(): void { $this->assertSame('pagosaextranjeros:Pagosaextranjeros', $this->element->getElementName()); } public function testGetNoBeneficiario(): void { $this->assertNull($this->element->searchNode('pagosaextranjeros:NoBeneficiario')); $child = $this->element->getNoBeneficiario(); $this->assertInstanceOf(NoBeneficiario::class, $child); $this->assertSame($child, $this->element->searchNode('pagosaextranjeros:NoBeneficiario')); } public function testAddNoBeneficiario(): void { $first = $this->element->addNoBeneficiario(['Rfc' => 'FOO']); $this->assertInstanceOf(NoBeneficiario::class, $first); $this->assertSame('FOO', $first['Rfc']); $second = $this->element->addNoBeneficiario(['Rfc' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['Rfc']); } public function testGetBeneficiario(): void { $this->assertNull($this->element->searchNode('pagosaextranjeros:Beneficiario')); $child = $this->element->getBeneficiario(); $this->assertInstanceOf(Beneficiario::class, $child); $this->assertSame($child, $this->element->searchNode('pagosaextranjeros:Beneficiario')); } public function testAddBeneficiario(): void { $first = $this->element->addBeneficiario(['Rfc' => 'BAZ']); $this->assertInstanceOf(Beneficiario::class, $first); $this->assertSame('BAZ', $first['Rfc']); $second = $this->element->addBeneficiario(['Rfc' => 'BAR']); $this->assertSame($first, $second); $this->assertSame('BAR', $first['Rfc']); } public function testHasFixedAttributes(): void { $namespace = 'http://www.sat.gob.mx/esquemas/retencionpago/1/pagosaextranjeros'; $this->assertSame('1.0', $this->element['Version']); $this->assertSame($namespace, $this->element['xmlns:pagosaextranjeros']); $this->assertStringStartsWith($namespace . ' http://', $this->element['xsi:schemaLocation']); } public function testChildrenOrder(): void { // add in inverse order $this->element->getBeneficiario(); $this->element->getNoBeneficiario(); // retrieve in correct order $this->assertInstanceOf(NoBeneficiario::class, $this->element->children()->get(0)); $this->assertInstanceOf(Beneficiario::class, $this->element->children()->get(1)); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/PagosAExtranjeros10/BeneficiarioTest.php
tests/CfdiUtilsTests/Elements/PagosAExtranjeros10/BeneficiarioTest.php
<?php namespace CfdiUtilsTests\Elements\PagosAExtranjeros10; use CfdiUtils\Elements\PagosAExtranjeros10\Beneficiario; use PHPUnit\Framework\TestCase; final class BeneficiarioTest extends TestCase { public Beneficiario $element; public function setUp(): void { parent::setUp(); $this->element = new Beneficiario(); } public function testGetElementName(): void { $this->assertSame('pagosaextranjeros:Beneficiario', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/PagosAExtranjeros10/NoBeneficiarioTest.php
tests/CfdiUtilsTests/Elements/PagosAExtranjeros10/NoBeneficiarioTest.php
<?php namespace CfdiUtilsTests\Elements\PagosAExtranjeros10; use CfdiUtils\Elements\PagosAExtranjeros10\NoBeneficiario; use PHPUnit\Framework\TestCase; final class NoBeneficiarioTest extends TestCase { public NoBeneficiario $element; public function setUp(): void { parent::setUp(); $this->element = new NoBeneficiario(); } public function testGetElementName(): void { $this->assertSame('pagosaextranjeros:NoBeneficiario', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/ImpLocal10/RetencionesLocalesTest.php
tests/CfdiUtilsTests/Elements/ImpLocal10/RetencionesLocalesTest.php
<?php namespace CfdiUtilsTests\Elements\ImpLocal10; use CfdiUtils\Elements\ImpLocal10\RetencionesLocales; use PHPUnit\Framework\TestCase; final class RetencionesLocalesTest extends TestCase { public RetencionesLocales $element; protected function setUp(): void { parent::setUp(); $this->element = new RetencionesLocales(); } public function testGetElementName(): void { $this->assertSame('implocal:RetencionesLocales', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/ImpLocal10/TrasladosLocalesTest.php
tests/CfdiUtilsTests/Elements/ImpLocal10/TrasladosLocalesTest.php
<?php namespace CfdiUtilsTests\Elements\ImpLocal10; use CfdiUtils\Elements\ImpLocal10\TrasladosLocales; use PHPUnit\Framework\TestCase; final class TrasladosLocalesTest extends TestCase { public TrasladosLocales $element; protected function setUp(): void { parent::setUp(); $this->element = new TrasladosLocales(); } public function testGetElementName(): void { $this->assertSame('implocal:TrasladosLocales', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/ImpLocal10/ImpuestosLocalesTest.php
tests/CfdiUtilsTests/Elements/ImpLocal10/ImpuestosLocalesTest.php
<?php namespace CfdiUtilsTests\Elements\ImpLocal10; use CfdiUtils\Elements\ImpLocal10\ImpuestosLocales; use CfdiUtils\Elements\ImpLocal10\RetencionesLocales; use CfdiUtils\Elements\ImpLocal10\TrasladosLocales; use PHPUnit\Framework\TestCase; final class ImpuestosLocalesTest extends TestCase { public ImpuestosLocales $element; protected function setUp(): void { parent::setUp(); $this->element = new ImpuestosLocales(); } public function testConstructedObject(): void { $this->assertSame('implocal:ImpuestosLocales', $this->element->getElementName()); } public function testRetencion(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addRetencionLocal(['id' => 'first']); $this->assertInstanceOf(RetencionesLocales::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addRetencionLocal(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } public function testTraslado(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addTrasladoLocal(['id' => 'first']); $this->assertInstanceOf(TrasladosLocales::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addTrasladoLocal(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } public function testChildrenOrder(): void { // add in inverse order $this->element->addTrasladoLocal(); $this->element->addRetencionLocal(); // retrieve in correct order $this->assertInstanceOf(RetencionesLocales::class, $this->element->children()->get(0)); $this->assertInstanceOf(TrasladosLocales::class, $this->element->children()->get(1)); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Iedu10/IeduTest.php
tests/CfdiUtilsTests/Elements/Iedu10/IeduTest.php
<?php namespace CfdiUtilsTests\Elements\Iedu10; use CfdiUtils\Elements\Iedu10\InstEducativas; use CfdiUtilsTests\Elements\ElementTestCase; final class IeduTest extends ElementTestCase { public function testInstEducativas(): void { $element = new InstEducativas(); $this->assertElementHasName($element, 'iedu:instEducativas'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:iedu' => 'http://www.sat.gob.mx/iedu', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/iedu' . ' http://www.sat.gob.mx/sitio_internet/cfd/iedu/iedu.xsd', 'version' => '1.0', ]); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/PlataformasTecnologicas10/PlataformasTecnologicas10Test.php
tests/CfdiUtilsTests/Elements/PlataformasTecnologicas10/PlataformasTecnologicas10Test.php
<?php namespace CfdiUtilsTests\Elements\PlataformasTecnologicas10; use CfdiUtils\Elements\PlataformasTecnologicas10\ComisionDelServicio; use CfdiUtils\Elements\PlataformasTecnologicas10\ContribucionGubernamental; use CfdiUtils\Elements\PlataformasTecnologicas10\DetallesDelServicio; use CfdiUtils\Elements\PlataformasTecnologicas10\ImpuestosTrasladadosdelServicio; use CfdiUtils\Elements\PlataformasTecnologicas10\Servicios; use CfdiUtils\Elements\PlataformasTecnologicas10\ServiciosPlataformasTecnologicas; use CfdiUtilsTests\Elements\ElementTestCase; class PlataformasTecnologicas10Test extends ElementTestCase { public function testPlataformasTecnologicas(): void { $element = new ServiciosPlataformasTecnologicas(); $this->assertElementHasName($element, 'plataformasTecnologicas:ServiciosPlataformasTecnologicas'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:plataformasTecnologicas' => 'http://www.sat.gob.mx/esquemas/retencionpago/1' . '/PlataformasTecnologicas10', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/esquemas/retencionpago/1/PlataformasTecnologicas10' . ' http://www.sat.gob.mx/esquemas/retencionpago/1/PlataformasTecnologicas10' . '/ServiciosPlataformasTecnologicas10.xsd', 'Version' => '1.0', ]); $this->assertElementHasChildSingle($element, Servicios::class); } public function testServicios(): void { $element = new Servicios(); $this->assertElementHasName($element, 'plataformasTecnologicas:Servicios'); $this->assertElementHasChildMultiple($element, DetallesDelServicio::class); } public function testDetallesDelServicio(): void { $element = new DetallesDelServicio(); $this->assertElementHasName($element, 'plataformasTecnologicas:DetallesDelServicio'); $this->assertElementHasChildSingle($element, ImpuestosTrasladadosdelServicio::class); $this->assertElementHasChildSingle($element, ContribucionGubernamental::class); $this->assertElementHasChildSingle($element, ComisionDelServicio::class); } public function testImpuestosTrasladados(): void { $element = new ImpuestosTrasladadosdelServicio(); $this->assertElementHasName($element, 'plataformasTecnologicas:ImpuestosTrasladadosdelServicio'); } public function testContribucionGubernamental(): void { $element = new ContribucionGubernamental(); $this->assertElementHasName($element, 'plataformasTecnologicas:ContribucionGubernamental'); } public function testComisionDelServicio(): void { $element = new ComisionDelServicio(); $this->assertElementHasName($element, 'plataformasTecnologicas:ComisionDelServicio'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/CartaPorte30/CartaPorteTest.php
tests/CfdiUtilsTests/Elements/CartaPorte30/CartaPorteTest.php
<?php namespace CfdiUtilsTests\Elements\CartaPorte30; use CfdiUtils\Elements\CartaPorte30\Autotransporte; use CfdiUtils\Elements\CartaPorte30\CantidadTransporta; use CfdiUtils\Elements\CartaPorte30\Carro; use CfdiUtils\Elements\CartaPorte30\CartaPorte; use CfdiUtils\Elements\CartaPorte30\Contenedor; use CfdiUtils\Elements\CartaPorte30\DerechosDePaso; use CfdiUtils\Elements\CartaPorte30\DetalleMercancia; use CfdiUtils\Elements\CartaPorte30\DocumentacionAduanera; use CfdiUtils\Elements\CartaPorte30\Domicilio; use CfdiUtils\Elements\CartaPorte30\FiguraTransporte; use CfdiUtils\Elements\CartaPorte30\GuiasIdentificacion; use CfdiUtils\Elements\CartaPorte30\IdentificacionVehicular; use CfdiUtils\Elements\CartaPorte30\Mercancia; use CfdiUtils\Elements\CartaPorte30\Mercancias; use CfdiUtils\Elements\CartaPorte30\PartesTransporte; use CfdiUtils\Elements\CartaPorte30\Remolque; use CfdiUtils\Elements\CartaPorte30\RemolqueCCP; use CfdiUtils\Elements\CartaPorte30\Remolques; use CfdiUtils\Elements\CartaPorte30\RemolquesCCP; use CfdiUtils\Elements\CartaPorte30\Seguros; use CfdiUtils\Elements\CartaPorte30\TiposFigura; use CfdiUtils\Elements\CartaPorte30\TransporteAereo; use CfdiUtils\Elements\CartaPorte30\TransporteFerroviario; use CfdiUtils\Elements\CartaPorte30\TransporteMaritimo; use CfdiUtils\Elements\CartaPorte30\Ubicacion; use CfdiUtils\Elements\CartaPorte30\Ubicaciones; use CfdiUtilsTests\Elements\ElementTestCase; final class CartaPorteTest extends ElementTestCase { public function testCartaPorte(): void { $element = new CartaPorte(); $this->assertElementHasName($element, 'cartaporte30:CartaPorte'); $this->assertElementHasOrder($element, [ 'cartaporte30:Ubicaciones', 'cartaporte30:Mercancias', 'cartaporte30:FiguraTransporte', ]); $this->assertElementHasFixedAttributes($element, [ 'xmlns:cartaporte30' => 'http://www.sat.gob.mx/CartaPorte30', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/CartaPorte30' . ' http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte30.xsd', 'Version' => '3.0', ]); $this->assertElementHasChildSingle($element, Ubicaciones::class); $this->assertElementHasChildSingle($element, Mercancias::class); $this->assertElementHasChildSingle($element, FiguraTransporte::class); } public function testUbicaciones(): void { $element = new Ubicaciones(); $this->assertElementHasName($element, 'cartaporte30:Ubicaciones'); $this->assertElementHasChildMultiple($element, Ubicacion::class); } public function testUbicacion(): void { $element = new Ubicacion(); $this->assertElementHasName($element, 'cartaporte30:Ubicacion'); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testDomicilio(): void { $element = new Domicilio(); $this->assertElementHasName($element, 'cartaporte30:Domicilio'); } public function testMercancias(): void { $element = new Mercancias(); $this->assertElementHasName($element, 'cartaporte30:Mercancias'); $this->assertElementHasOrder($element, [ 'cartaporte30:Mercancia', 'cartaporte30:Autotransporte', 'cartaporte30:TransporteMaritimo', 'cartaporte30:TransporteAereo', 'cartaporte30:TransporteFerroviario', ]); $this->assertElementHasChildMultiple($element, Mercancia::class); $this->assertElementHasChildSingle($element, Autotransporte::class); $this->assertElementHasChildSingle($element, TransporteMaritimo::class); $this->assertElementHasChildSingle($element, TransporteAereo::class); $this->assertElementHasChildSingle($element, TransporteFerroviario::class); } public function testMercancia(): void { $element = new Mercancia(); $this->assertElementHasName($element, 'cartaporte30:Mercancia'); $this->assertElementHasOrder($element, [ 'cartaporte30:DocumentacionAduanera', 'cartaporte30:GuiasIdentificacion', 'cartaporte30:CantidadTransporta', 'cartaporte30:DetalleMercancia', ]); $this->assertElementHasChildMultiple($element, DocumentacionAduanera::class); $this->assertElementHasChildMultiple($element, GuiasIdentificacion::class); $this->assertElementHasChildMultiple($element, CantidadTransporta::class); $this->assertElementHasChildSingle($element, DetalleMercancia::class); } public function testDocumentacionAduanera(): void { $element = new DocumentacionAduanera(); $this->assertElementHasName($element, 'cartaporte30:DocumentacionAduanera'); } public function testGuiasIdentificacion(): void { $element = new GuiasIdentificacion(); $this->assertElementHasName($element, 'cartaporte30:GuiasIdentificacion'); } public function testCantidadTransporta(): void { $element = new CantidadTransporta(); $this->assertElementHasName($element, 'cartaporte30:CantidadTransporta'); } public function testDetalleMercancia(): void { $element = new DetalleMercancia(); $this->assertElementHasName($element, 'cartaporte30:DetalleMercancia'); } public function testAutotransporte(): void { $element = new Autotransporte(); $this->assertElementHasName($element, 'cartaporte30:Autotransporte'); $this->assertElementHasOrder($element, [ 'cartaporte30:IdentificacionVehicular', 'cartaporte30:Seguros', 'cartaporte30:Remolques', ]); $this->assertElementHasChildSingle($element, IdentificacionVehicular::class); $this->assertElementHasChildSingle($element, Seguros::class); $this->assertElementHasChildSingle($element, Remolques::class); } public function testIdentificacionVehicular(): void { $element = new IdentificacionVehicular(); $this->assertElementHasName($element, 'cartaporte30:IdentificacionVehicular'); } public function testSeguros(): void { $element = new Seguros(); $this->assertElementHasName($element, 'cartaporte30:Seguros'); } public function testRemolques(): void { $element = new Remolques(); $this->assertElementHasName($element, 'cartaporte30:Remolques'); $this->assertElementHasChildMultiple($element, Remolque::class); } public function testRemolque(): void { $element = new Remolque(); $this->assertElementHasName($element, 'cartaporte30:Remolque'); } public function testTransporteMaritimo(): void { $element = new TransporteMaritimo(); $this->assertElementHasName($element, 'cartaporte30:TransporteMaritimo'); $this->assertElementHasChildMultiple($element, Contenedor::class); $this->assertElementHasChildSingle($element, RemolquesCCP::class); } public function testRemolquesCPP(): void { $element = new RemolquesCCP(); $this->assertElementHasName($element, 'cartaporte30:RemolquesCCP'); $this->assertElementHasChildMultiple($element, RemolqueCCP::class); } public function testRemolqueCPP(): void { $element = new RemolqueCCP(); $this->assertElementHasName($element, 'cartaporte30:RemolqueCCP'); } public function testTransporteAereo(): void { $element = new TransporteAereo(); $this->assertElementHasName($element, 'cartaporte30:TransporteAereo'); } public function testTransporteFerroviario(): void { $element = new TransporteFerroviario(); $this->assertElementHasName($element, 'cartaporte30:TransporteFerroviario'); $this->assertElementHasOrder($element, [ 'cartaporte30:DerechosDePaso', 'cartaporte30:Carro', ]); $this->assertElementHasChildMultiple($element, DerechosDePaso::class); $this->assertElementHasChildMultiple($element, Carro::class); } public function testDerechosDePaso(): void { $element = new DerechosDePaso(); $this->assertElementHasName($element, 'cartaporte30:DerechosDePaso'); } public function testCarro(): void { $element = new Carro(); $this->assertElementHasName($element, 'cartaporte30:Carro'); $this->assertElementHasChildMultiple($element, Contenedor::class); } public function testContenedor(): void { $element = new Contenedor(); $this->assertElementHasName($element, 'cartaporte30:Contenedor'); } public function testFiguraTransporte(): void { $element = new FiguraTransporte(); $this->assertElementHasName($element, 'cartaporte30:FiguraTransporte'); $this->assertElementHasChildMultiple($element, TiposFigura::class); } public function testTiposFigura(): void { $element = new TiposFigura(); $this->assertElementHasName($element, 'cartaporte30:TiposFigura'); $this->assertElementHasOrder($element, [ 'cartaporte30:PartesTransporte', 'cartaporte30:Domicilio', ]); $this->assertElementHasChildMultiple($element, PartesTransporte::class); $this->assertElementHasChildSingle($element, Domicilio::class); } public function testPartesTransporte(): void { $element = new PartesTransporte(); $this->assertElementHasName($element, 'cartaporte30:PartesTransporte'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Ine11/IneTest.php
tests/CfdiUtilsTests/Elements/Ine11/IneTest.php
<?php namespace CfdiUtilsTests\Elements\Ine11; use CfdiUtils\Elements\Ine11\Ine; use CfdiUtilsTests\Elements\ElementTestCase; final class IneTest extends ElementTestCase { public function testDonatarias(): void { $element = new Ine(); $this->assertElementHasName($element, 'ine:INE'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:ine' => 'http://www.sat.gob.mx/ine', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/ine' . ' http://www.sat.gob.mx/sitio_internet/cfd/ine/ine11.xsd', 'Version' => '1.1', ]); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Tfd11/TimbreFiscalDigitalTest.php
tests/CfdiUtilsTests/Elements/Tfd11/TimbreFiscalDigitalTest.php
<?php namespace CfdiUtilsTests\Elements\Tfd11; use CfdiUtils\Elements\Cfdi33\Comprobante; use CfdiUtils\Elements\Tfd11\TimbreFiscalDigital; use PHPUnit\Framework\TestCase; final class TimbreFiscalDigitalTest extends TestCase { /**@var Comprobante */ public $element; protected function setUp(): void { parent::setUp(); $this->element = new TimbreFiscalDigital(); } public function testGetElementName(): void { $this->assertSame('tfd:TimbreFiscalDigital', $this->element->getElementName()); } public function testHasFixedAttributes(): void { $namespace = 'http://www.sat.gob.mx/TimbreFiscalDigital'; $this->assertSame('1.1', $this->element['Version']); $this->assertSame($namespace, $this->element['xmlns:tfd']); $this->assertStringStartsWith($namespace . ' http://', $this->element['xsi:schemaLocation']); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/ConsumoDeCombustibles11/ConsumoDeCombustiblesTest.php
tests/CfdiUtilsTests/Elements/ConsumoDeCombustibles11/ConsumoDeCombustiblesTest.php
<?php namespace CfdiUtilsTests\Elements\ConsumoDeCombustibles11; use CfdiUtils\Elements\ConsumoDeCombustibles11\ConceptoConsumoDeCombustibles; use CfdiUtils\Elements\ConsumoDeCombustibles11\Conceptos; use CfdiUtils\Elements\ConsumoDeCombustibles11\ConsumoDeCombustibles; use CfdiUtils\Elements\ConsumoDeCombustibles11\Determinado; use CfdiUtils\Elements\ConsumoDeCombustibles11\Determinados; use CfdiUtilsTests\Elements\ElementTestCase; class ConsumoDeCombustiblesTest extends ElementTestCase { public function testConsumoDeCombustibles(): void { $element = new ConsumoDeCombustibles(); $this->assertElementHasName($element, 'consumodecombustibles11:ConsumoDeCombustibles'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:consumodecombustibles11' => 'http://www.sat.gob.mx/ConsumoDeCombustibles11', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/ConsumoDeCombustibles11' . ' http://www.sat.gob.mx/sitio_internet/cfd/consumodecombustibles/consumodeCombustibles11.xsd', 'version' => '1.1', ]); $this->assertElementHasChildSingle($element, Conceptos::class); } public function testConceptos(): void { $element = new Conceptos(); $this->assertElementHasName($element, 'consumodecombustibles11:Conceptos'); $this->assertElementHasChildMultiple($element, ConceptoConsumoDeCombustibles::class); } public function testConceptoConsumoDeCombustibles(): void { $element = new ConceptoConsumoDeCombustibles(); $this->assertElementHasName($element, 'consumodecombustibles11:ConceptoConsumoDeCombustibles'); $this->assertElementHasChildSingle($element, Determinados::class); } public function testDeterminados(): void { $element = new Determinados(); $this->assertElementHasName($element, 'consumodecombustibles11:Determinados'); $this->assertElementHasChildMultiple($element, Determinado::class); } public function testDeterminado(): void { $element = new Determinado(); $this->assertElementHasName($element, 'consumodecombustibles11:Determinado'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/ParcialesConstruccion10/ParcialesConstruccion10Test.php
tests/CfdiUtilsTests/Elements/ParcialesConstruccion10/ParcialesConstruccion10Test.php
<?php namespace CfdiUtilsTests\Elements\ParcialesConstruccion10; use CfdiUtils\Elements\ParcialesConstruccion10\Inmueble; use CfdiUtils\Elements\ParcialesConstruccion10\ParcialesConstruccion; use CfdiUtilsTests\Elements\ElementTestCase; class ParcialesConstruccion10Test extends ElementTestCase { public function testParcialesConstruccion(): void { $element = new ParcialesConstruccion(); $this->assertElementHasName($element, 'servicioparcial:parcialesconstruccion'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:servicioparcial' => 'http://www.sat.gob.mx/servicioparcialconstruccion', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/servicioparcialconstruccion' . ' http://www.sat.gob.mx/sitio_internet/cfd' . '/servicioparcialconstruccion/servicioparcialconstruccion.xsd', 'Version' => '1.0', ]); $this->assertElementHasChildSingle($element, Inmueble::class); } public function testInmueble(): void { $element = new Inmueble(); $this->assertElementHasName($element, 'servicioparcial:Inmueble'); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Donatarias11/DonatariasTest.php
tests/CfdiUtilsTests/Elements/Donatarias11/DonatariasTest.php
<?php namespace CfdiUtilsTests\Elements\Donatarias11; use CfdiUtils\Elements\Donatarias11\Donatarias; use CfdiUtilsTests\Elements\ElementTestCase; final class DonatariasTest extends ElementTestCase { public function testDonatarias(): void { $element = new Donatarias(); $this->assertElementHasName($element, 'donat:Donatarias'); $this->assertElementHasFixedAttributes($element, [ 'xmlns:donat' => 'http://www.sat.gob.mx/donat', 'xsi:schemaLocation' => 'http://www.sat.gob.mx/donat' . ' http://www.sat.gob.mx/sitio_internet/cfd/donat/donat11.xsd', 'version' => '1.1', ]); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Cce11/DescripcionesEspecificasTest.php
tests/CfdiUtilsTests/Elements/Cce11/DescripcionesEspecificasTest.php
<?php namespace CfdiUtilsTests\Elements\Cce11; use CfdiUtils\Elements\Cce11\DescripcionesEspecificas; use PHPUnit\Framework\TestCase; final class DescripcionesEspecificasTest extends TestCase { public DescripcionesEspecificas $element; protected function setUp(): void { parent::setUp(); $this->element = new DescripcionesEspecificas(); } public function testConstructedObject(): void { $this->assertSame('cce11:DescripcionesEspecificas', $this->element->getElementName()); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Cce11/MercanciasTest.php
tests/CfdiUtilsTests/Elements/Cce11/MercanciasTest.php
<?php namespace CfdiUtilsTests\Elements\Cce11; use CfdiUtils\Elements\Cce11\Mercancia; use CfdiUtils\Elements\Cce11\Mercancias; use PHPUnit\Framework\TestCase; final class MercanciasTest extends TestCase { public Mercancias $element; protected function setUp(): void { parent::setUp(); $this->element = new Mercancias(); } public function testConstructedObject(): void { $this->assertSame('cce11:Mercancias', $this->element->getElementName()); } public function testMercancia(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addMercancia(['id' => 'first']); $this->assertInstanceOf(Mercancia::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addMercancia(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false
eclipxe13/CfdiUtils
https://github.com/eclipxe13/CfdiUtils/blob/6786b3ee34831ef0d633302226414682a7a35aca/tests/CfdiUtilsTests/Elements/Cce11/MercanciaTest.php
tests/CfdiUtilsTests/Elements/Cce11/MercanciaTest.php
<?php namespace CfdiUtilsTests\Elements\Cce11; use CfdiUtils\Elements\Cce11\DescripcionesEspecificas; use CfdiUtils\Elements\Cce11\Mercancia; use PHPUnit\Framework\TestCase; final class MercanciaTest extends TestCase { public Mercancia $element; protected function setUp(): void { parent::setUp(); $this->element = new Mercancia(); } public function testConstructedObject(): void { $this->assertSame('cce11:Mercancia', $this->element->getElementName()); } public function testDescripcionesEspecificas(): void { // object is empty $this->assertCount(0, $this->element); // add insert first element $first = $this->element->addDescripcionesEspecificas(['id' => 'first']); $this->assertInstanceOf(DescripcionesEspecificas::class, $first); $this->assertSame('first', $first['id']); $this->assertCount(1, $this->element); // add insert second element and is not the same $second = $this->element->addDescripcionesEspecificas(['id' => 'second']); $this->assertSame('second', $second['id']); $this->assertCount(2, $this->element); $this->assertNotSame($first, $second); } }
php
MIT
6786b3ee34831ef0d633302226414682a7a35aca
2026-01-05T04:57:52.988826Z
false