diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 3556d07..da272ea 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -3,31 +3,30 @@ declare(strict_types=1); /* - * This file is part of PHP CS Fixer. - * - * (c) Fabien Potencier - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ +* This file is part of PHP CS Fixer. +* +* (c) Fabien Potencier +* Dariusz Rumiński +* +* This source file is subject to the MIT license that is bundled +* with this source code in the file LICENSE. +*/ $header = <<<'EOF' - This file is part of PHP CS Fixer. +This file is part of PHP CS Fixer. - (c) Fabien Potencier - Dariusz Rumiński +(c) Fabien Potencier +Dariusz Rumiński - This source file is subject to the MIT license that is bundled - with this source code in the file LICENSE. - EOF; +This source file is subject to the MIT license that is bundled +with this source code in the file LICENSE. +EOF; $finder = (new PhpCsFixer\Finder()) ->ignoreDotFiles(false) ->ignoreVCSIgnored(true) ->exclude(['dev-tools/phpstan', 'tests/Fixtures']) - ->in(__DIR__) -; + ->in(__DIR__); return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) diff --git a/test-temp.php b/test-temp.php index 1534f64..cc75810 100644 --- a/test-temp.php +++ b/test-temp.php @@ -1,18 +1,6 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -require 'vendor/autoload.php'; +require('vendor/autoload.php'); use Axiostudio\FatturaElettronica\FatturaElettronica; @@ -33,7 +21,7 @@ $header = [ $datiTrasmissione, $cedentePrestatore, - $cessionarioCommittente, + $cessionarioCommittente ]; $datiGeneraliDocumento = ['123', '2021-01-01', '345.22']; @@ -46,7 +34,7 @@ $body = [ $datiGenerali, - $datiDatiPagamento, + $datiDatiPagamento ]; $dettaglioLinee = [ @@ -66,9 +54,9 @@ var_dump($datiXml); -/* +/* $data = [ - + 'FatturaElettronicaBody' => [ 'DatiGenerali' => [ 'DatiGeneraliDocumento' => [ @@ -113,4 +101,4 @@ ] ] ]; -*/ +*/ \ No newline at end of file diff --git a/tests/AnagraficaTest.php b/tests/AnagraficaTest.php index aad7203..0360a54 100644 --- a/tests/AnagraficaTest.php +++ b/tests/AnagraficaTest.php @@ -1,28 +1,11 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\Anagrafica; use PHPUnit\Framework\TestCase; -/** - * @internal - * - * @coversNothing - */ -final class AnagraficaTest extends TestCase +class AnagraficaTest extends TestCase { public function testConstructor(): void { @@ -32,9 +15,9 @@ public function testConstructor(): void $anagrafica = new Anagrafica($denominazione, $nome, $cognome); - self::assertInstanceOf(Anagrafica::class, $anagrafica); - self::assertSame($denominazione, $anagrafica->Denominazione); - self::assertSame($nome, $anagrafica->Nome); - self::assertSame($cognome, $anagrafica->Cognome); + $this->assertInstanceOf(Anagrafica::class, $anagrafica); + $this->assertEquals($denominazione, $anagrafica->Denominazione); + $this->assertEquals($nome, $anagrafica->Nome); + $this->assertEquals($cognome, $anagrafica->Cognome); } } diff --git a/tests/CedentePrestatoreTest.php b/tests/CedentePrestatoreTest.php index 243064d..2f15c47 100644 --- a/tests/CedentePrestatoreTest.php +++ b/tests/CedentePrestatoreTest.php @@ -1,46 +1,30 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; -use Axiostudio\FatturaElettronica\Models\CedentePrestatore; -use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; -use Axiostudio\FatturaElettronica\Models\Sede; use PHPUnit\Framework\TestCase; +use Axiostudio\FatturaElettronica\Models\Sede; +use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; +use Axiostudio\FatturaElettronica\Models\CedentePrestatore; -/** - * @internal - * - * @coversNothing - */ -final class CedentePrestatoreTest extends TestCase +class CedentePrestatoreTest extends TestCase { public function testConstructor(): void { + $DatiAnagrafici = ['Company Ltd', '0123456789']; $Sede = [ 'Via Roma, 1', '00100', 'Roma', 'RM', - 'IT', + 'IT' ]; $cedentePrestatore = new CedentePrestatore($DatiAnagrafici, $Sede); - self::assertInstanceOf(CedentePrestatore::class, $cedentePrestatore); - self::assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); - self::assertInstanceOf(Sede::class, $cedentePrestatore->Sede); + $this->assertInstanceOf(CedentePrestatore::class, $cedentePrestatore); + $this->assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); + $this->assertInstanceOf(Sede::class, $cedentePrestatore->Sede); } } diff --git a/tests/CessionarioCommittente.php b/tests/CessionarioCommittente.php index 0d1f95c..0463dfc 100644 --- a/tests/CessionarioCommittente.php +++ b/tests/CessionarioCommittente.php @@ -1,46 +1,30 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; -use Axiostudio\FatturaElettronica\Models\CessionarioCommittente; -use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; -use Axiostudio\FatturaElettronica\Models\Sede; use PHPUnit\Framework\TestCase; +use Axiostudio\FatturaElettronica\Models\Sede; +use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; +use Axiostudio\FatturaElettronica\Models\CessionarioCommittente; -/** - * @internal - * - * @coversNothing - */ -final class CessionarioCommittente extends TestCase +class CessionarioCommittenteTest extends TestCase { public function testConstructor(): void { + $DatiAnagrafici = ['Company Ltd', '0123456789']; $Sede = [ 'Via Roma, 1', '00100', 'Roma', 'RM', - 'IT', + 'IT' ]; - $cedentePrestatore = new self($DatiAnagrafici, $Sede); + $cedentePrestatore = new CessionarioCommittente($DatiAnagrafici, $Sede); - self::assertInstanceOf(self::class, $cedentePrestatore); - self::assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); - self::assertInstanceOf(Sede::class, $cedentePrestatore->Sede); + $this->assertInstanceOf(CessionarioCommittente::class, $cedentePrestatore); + $this->assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); + $this->assertInstanceOf(Sede::class, $cedentePrestatore->Sede); } } diff --git a/tests/DatiAnagraficiTest.php b/tests/DatiAnagraficiTest.php index 3c09b63..0878046 100644 --- a/tests/DatiAnagraficiTest.php +++ b/tests/DatiAnagraficiTest.php @@ -1,30 +1,13 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; -use Axiostudio\FatturaElettronica\Models\Anagrafica; use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; use Axiostudio\FatturaElettronica\Models\Id; +use Axiostudio\FatturaElettronica\Models\Anagrafica; use PHPUnit\Framework\TestCase; -/** - * @internal - * - * @coversNothing - */ -final class DatiAnagraficiTest extends TestCase +class DatiAnagraficiTest extends TestCase { public function testConstructor(): void { @@ -36,10 +19,10 @@ public function testConstructor(): void $datiAnagrafici = new DatiAnagrafici($id, $anagrafica, $codiceFiscale, $regimeFiscale); - self::assertInstanceOf(DatiAnagrafici::class, $datiAnagrafici); - self::assertInstanceOf(Id::class, $datiAnagrafici->IdFiscaleIVA); - self::assertInstanceOf(Anagrafica::class, $datiAnagrafici->Anagrafica); - self::assertSame($codiceFiscale, $datiAnagrafici->CodiceFiscale); - self::assertSame($regimeFiscale, $datiAnagrafici->RegimeFiscale); + $this->assertInstanceOf(DatiAnagrafici::class, $datiAnagrafici); + $this->assertInstanceOf(Id::class, $datiAnagrafici->IdFiscaleIVA); + $this->assertInstanceOf(Anagrafica::class, $datiAnagrafici->Anagrafica); + $this->assertEquals($codiceFiscale, $datiAnagrafici->CodiceFiscale); + $this->assertEquals($regimeFiscale, $datiAnagrafici->RegimeFiscale); } } diff --git a/tests/DatiBeniservizi.php b/tests/DatiBeniservizi.php index c0e9a1e..53aa212 100644 --- a/tests/DatiBeniservizi.php +++ b/tests/DatiBeniservizi.php @@ -1,34 +1,17 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DatiBeniServizi; use PHPUnit\Framework\TestCase; -/** - * @internal - * - * @coversNothing - */ -final class DatiBeniservizi extends TestCase +class DatiBeniServiziTest extends TestCase { public function testConstructor(): void { - $datiBeniServizi = new self(); + $datiBeniServizi = new DatiBeniServizi(); - self::assertInstanceOf(self::class, $datiBeniServizi); - self::assertNull($datiBeniServizi->XmlDatiBeniServizi); + $this->assertInstanceOf(DatiBeniServizi::class, $datiBeniServizi); + $this->assertNull($datiBeniServizi->XmlDatiBeniServizi); } } diff --git a/tests/DatiGeneraliDocumentoTest.php b/tests/DatiGeneraliDocumentoTest.php index 947c408..0ce884e 100644 --- a/tests/DatiGeneraliDocumentoTest.php +++ b/tests/DatiGeneraliDocumentoTest.php @@ -1,17 +1,5 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DatiGeneraliDocumento; @@ -19,12 +7,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -/** - * @internal - * - * @coversNothing - */ -final class DatiGeneraliDocumentoTest extends TestCase +class DatiGeneraliDocumentoTest extends TestCase { public function testConstructor(): void { @@ -34,13 +17,13 @@ public function testConstructor(): void $datiGeneraliDocumento = new DatiGeneraliDocumento($numero, $data, $importoTotaleDocumento); - self::assertInstanceOf(DatiGeneraliDocumento::class, $datiGeneraliDocumento); - self::assertSame($numero, $datiGeneraliDocumento->Numero); - self::assertSame($data, $datiGeneraliDocumento->Data); - self::assertSame($importoTotaleDocumento, $datiGeneraliDocumento->ImportoTotaleDocumento); - self::assertSame(Settings::CausaleDefault(), $datiGeneraliDocumento->Causale); - self::assertSame(Settings::TipoDocumentoDefault(), $datiGeneraliDocumento->TipoDocumento); - self::assertSame(Settings::ValutaDefault(), $datiGeneraliDocumento->Divisa); + $this->assertInstanceOf(DatiGeneraliDocumento::class, $datiGeneraliDocumento); + $this->assertEquals($numero, $datiGeneraliDocumento->Numero); + $this->assertEquals($data, $datiGeneraliDocumento->Data); + $this->assertEquals($importoTotaleDocumento, $datiGeneraliDocumento->ImportoTotaleDocumento); + $this->assertEquals(Settings::CausaleDefault(), $datiGeneraliDocumento->Causale); + $this->assertEquals(Settings::TipoDocumentoDefault(), $datiGeneraliDocumento->TipoDocumento); + $this->assertEquals(Settings::ValutaDefault(), $datiGeneraliDocumento->Divisa); } public function testValidation(): void @@ -51,6 +34,6 @@ public function testValidation(): void $violations = $validator->validate($datiGeneraliDocumento); - self::assertCount(0, $violations); + $this->assertCount(0, $violations); } } diff --git a/tests/DatiGeneraliTest.php b/tests/DatiGeneraliTest.php index f47614c..a681ca0 100644 --- a/tests/DatiGeneraliTest.php +++ b/tests/DatiGeneraliTest.php @@ -1,29 +1,12 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DatiGenerali; use Axiostudio\FatturaElettronica\Models\DatiGeneraliDocumento; use PHPUnit\Framework\TestCase; -/** - * @internal - * - * @coversNothing - */ -final class DatiGeneraliTest extends TestCase +class DatiGeneraliTest extends TestCase { public function testConstructor(): void { @@ -35,7 +18,7 @@ public function testConstructor(): void $datiGenerali = new DatiGenerali($datiGeneraliDocumento); - self::assertInstanceOf(DatiGenerali::class, $datiGenerali); - self::assertInstanceOf(DatiGeneraliDocumento::class, $datiGenerali->DatiGeneraliDocumento); + $this->assertInstanceOf(DatiGenerali::class, $datiGenerali); + $this->assertInstanceOf(DatiGeneraliDocumento::class, $datiGenerali->DatiGeneraliDocumento); } } diff --git a/tests/DatiPagamentoTest.php b/tests/DatiPagamentoTest.php index a284175..30e884d 100644 --- a/tests/DatiPagamentoTest.php +++ b/tests/DatiPagamentoTest.php @@ -1,30 +1,13 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; -use Axiostudio\FatturaElettronica\Models\DatiPagamento; use Axiostudio\FatturaElettronica\Models\DettaglioPagamento; +use Axiostudio\FatturaElettronica\Models\DatiPagamento; use Axiostudio\FatturaElettronica\Settings; use PHPUnit\Framework\TestCase; -/** - * @internal - * - * @coversNothing - */ -final class DatiPagamentoTest extends TestCase +class DatiPagamentoTest extends TestCase { public function testConstructor(): void { @@ -32,8 +15,8 @@ public function testConstructor(): void $datiPagamento = new DatiPagamento($dettaglioPagamento); - self::assertInstanceOf(DatiPagamento::class, $datiPagamento); - self::assertInstanceOf(DettaglioPagamento::class, $datiPagamento->DettaglioPagamento); - self::assertSame(Settings::CondizioniPagamentoDefault(), $datiPagamento->CondizioniPagamento); + $this->assertInstanceOf(DatiPagamento::class, $datiPagamento); + $this->assertInstanceOf(DettaglioPagamento::class, $datiPagamento->DettaglioPagamento); + $this->assertEquals(Settings::CondizioniPagamentoDefault(), $datiPagamento->CondizioniPagamento); } } diff --git a/tests/DatiRiepilogoTest.php b/tests/DatiRiepilogoTest.php index b7a8218..0908e07 100644 --- a/tests/DatiRiepilogoTest.php +++ b/tests/DatiRiepilogoTest.php @@ -1,28 +1,11 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DatiRiepilogo; use PHPUnit\Framework\TestCase; -/** - * @internal - * - * @coversNothing - */ -final class DatiRiepilogoTest extends TestCase +class DatiRiepilogoTest extends TestCase { public function testConstructorWithNatura(): void { @@ -32,10 +15,10 @@ public function testConstructorWithNatura(): void $datiRiepilogo = new DatiRiepilogo($imponibileImporto, $aliquotaIVA, $natura); - self::assertInstanceOf(DatiRiepilogo::class, $datiRiepilogo); - self::assertSame($imponibileImporto, $datiRiepilogo->ImponibileImporto); - self::assertSame($aliquotaIVA, $datiRiepilogo->AliquotaIVA); - self::assertSame($natura, $datiRiepilogo->Natura); - self::assertSame($imponibileImporto * $aliquotaIVA / 100, $datiRiepilogo->Imposta); + $this->assertInstanceOf(DatiRiepilogo::class, $datiRiepilogo); + $this->assertEquals($imponibileImporto, $datiRiepilogo->ImponibileImporto); + $this->assertEquals($aliquotaIVA, $datiRiepilogo->AliquotaIVA); + $this->assertEquals($natura, $datiRiepilogo->Natura); + $this->assertEquals($imponibileImporto * $aliquotaIVA / 100, $datiRiepilogo->Imposta); } } diff --git a/tests/DatiTrasmissioneTest.php b/tests/DatiTrasmissioneTest.php index e520b42..f87b9fe 100644 --- a/tests/DatiTrasmissioneTest.php +++ b/tests/DatiTrasmissioneTest.php @@ -1,17 +1,5 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DatiTrasmissione; @@ -19,12 +7,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -/** - * @internal - * - * @coversNothing - */ -final class DatiTrasmissioneTest extends TestCase +class DatiTrasmissioneTest extends TestCase { public function testConstructorWithEmailPECDestinatario(): void { @@ -37,12 +20,12 @@ public function testConstructorWithEmailPECDestinatario(): void $datiTrasmissione = new DatiTrasmissione($id, $progressivoInvio, $codiceDestinatario, $pecDestinatario, $formatoTrasmissione); - self::assertInstanceOf(DatiTrasmissione::class, $datiTrasmissione); - self::assertInstanceOf(Id::class, $datiTrasmissione->IdTrasmittente); - self::assertSame($progressivoInvio, $datiTrasmissione->ProgressivoInvio); - self::assertSame($codiceDestinatario, $datiTrasmissione->CodiceDestinatario); - self::assertSame($pecDestinatario, $datiTrasmissione->PECDestinatario); - self::assertSame($formatoTrasmissione, $datiTrasmissione->FormatoTrasmissione); + $this->assertInstanceOf(DatiTrasmissione::class, $datiTrasmissione); + $this->assertInstanceOf(Id::class, $datiTrasmissione->IdTrasmittente); + $this->assertEquals($progressivoInvio, $datiTrasmissione->ProgressivoInvio); + $this->assertEquals($codiceDestinatario, $datiTrasmissione->CodiceDestinatario); + $this->assertEquals($pecDestinatario, $datiTrasmissione->PECDestinatario); + $this->assertEquals($formatoTrasmissione, $datiTrasmissione->FormatoTrasmissione); } public function testConstructorWithoutEmailPECDestinatario(): void @@ -55,11 +38,11 @@ public function testConstructorWithoutEmailPECDestinatario(): void $datiTrasmissione = new DatiTrasmissione($id, $progressivoInvio, $codiceDestinatario, null, $formatoTrasmissione); - self::assertInstanceOf(DatiTrasmissione::class, $datiTrasmissione); - self::assertInstanceOf(Id::class, $datiTrasmissione->IdTrasmittente); - self::assertSame($progressivoInvio, $datiTrasmissione->ProgressivoInvio); - self::assertSame($codiceDestinatario, $datiTrasmissione->CodiceDestinatario); - self::assertSame($formatoTrasmissione, $datiTrasmissione->FormatoTrasmissione); + $this->assertInstanceOf(DatiTrasmissione::class, $datiTrasmissione); + $this->assertInstanceOf(Id::class, $datiTrasmissione->IdTrasmittente); + $this->assertEquals($progressivoInvio, $datiTrasmissione->ProgressivoInvio); + $this->assertEquals($codiceDestinatario, $datiTrasmissione->CodiceDestinatario); + $this->assertEquals($formatoTrasmissione, $datiTrasmissione->FormatoTrasmissione); } public function testValidation(): void @@ -72,6 +55,6 @@ public function testValidation(): void $violations = $validator->validate($datiTrasmissione); - self::assertCount(0, $violations); + $this->assertCount(0, $violations); } } diff --git a/tests/DettaglioLineeTest.php b/tests/DettaglioLineeTest.php index 1981c73..2038770 100644 --- a/tests/DettaglioLineeTest.php +++ b/tests/DettaglioLineeTest.php @@ -1,29 +1,12 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DettaglioLinee; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -/** - * @internal - * - * @coversNothing - */ -final class DettaglioLineeTest extends TestCase +class DettaglioLineeTest extends TestCase { public function testConstructorWithNatura(): void { @@ -36,14 +19,14 @@ public function testConstructorWithNatura(): void $dettaglioLinee = new DettaglioLinee($descrizione, $prezzoUnitario, $quantita, $unitaMisura, $aliquotaIVA, $natura); - self::assertInstanceOf(DettaglioLinee::class, $dettaglioLinee); - self::assertSame($descrizione, $dettaglioLinee->Descrizione); - self::assertSame($prezzoUnitario, $dettaglioLinee->PrezzoUnitario); - self::assertSame($quantita, $dettaglioLinee->Quantita); - self::assertSame($unitaMisura, $dettaglioLinee->UnitaMisura); - self::assertSame($aliquotaIVA, $dettaglioLinee->AliquotaIVA); - self::assertSame($prezzoUnitario * $quantita, $dettaglioLinee->PrezzoTotale); - self::assertSame($natura, $dettaglioLinee->Natura); + $this->assertInstanceOf(DettaglioLinee::class, $dettaglioLinee); + $this->assertEquals($descrizione, $dettaglioLinee->Descrizione); + $this->assertEquals($prezzoUnitario, $dettaglioLinee->PrezzoUnitario); + $this->assertEquals($quantita, $dettaglioLinee->Quantita); + $this->assertEquals($unitaMisura, $dettaglioLinee->UnitaMisura); + $this->assertEquals($aliquotaIVA, $dettaglioLinee->AliquotaIVA); + $this->assertEquals($prezzoUnitario * $quantita, $dettaglioLinee->PrezzoTotale); + $this->assertEquals($natura, $dettaglioLinee->Natura); } public function testConstructorWithoutNatura(): void @@ -56,13 +39,13 @@ public function testConstructorWithoutNatura(): void $dettaglioLinee = new DettaglioLinee($descrizione, $prezzoUnitario, $quantita, $unitaMisura, $aliquotaIVA); - self::assertInstanceOf(DettaglioLinee::class, $dettaglioLinee); - self::assertSame($descrizione, $dettaglioLinee->Descrizione); - self::assertSame($prezzoUnitario, $dettaglioLinee->PrezzoUnitario); - self::assertSame($quantita, $dettaglioLinee->Quantita); - self::assertSame($unitaMisura, $dettaglioLinee->UnitaMisura); - self::assertSame($aliquotaIVA, $dettaglioLinee->AliquotaIVA); - self::assertSame($prezzoUnitario * $quantita, $dettaglioLinee->PrezzoTotale); + $this->assertInstanceOf(DettaglioLinee::class, $dettaglioLinee); + $this->assertEquals($descrizione, $dettaglioLinee->Descrizione); + $this->assertEquals($prezzoUnitario, $dettaglioLinee->PrezzoUnitario); + $this->assertEquals($quantita, $dettaglioLinee->Quantita); + $this->assertEquals($unitaMisura, $dettaglioLinee->UnitaMisura); + $this->assertEquals($aliquotaIVA, $dettaglioLinee->AliquotaIVA); + $this->assertEquals($prezzoUnitario * $quantita, $dettaglioLinee->PrezzoTotale); } public function testValidation(): void @@ -73,6 +56,6 @@ public function testValidation(): void $violations = $validator->validate($dettaglioLinee); - self::assertCount(0, $violations); + $this->assertCount(0, $violations); } } diff --git a/tests/DettaglioPagamentoTest.php b/tests/DettaglioPagamentoTest.php index 2845deb..d57c139 100644 --- a/tests/DettaglioPagamentoTest.php +++ b/tests/DettaglioPagamentoTest.php @@ -1,29 +1,12 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\DettaglioPagamento; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -/** - * @internal - * - * @coversNothing - */ -final class DettaglioPagamentoTest extends TestCase +class DettaglioPagamentoTest extends TestCase { public function testConstructorWithIBAN(): void { @@ -53,18 +36,18 @@ public function testConstructorWithIBAN(): void $modalitaPagamento ); - self::assertInstanceOf(DettaglioPagamento::class, $dettaglioPagamento); - self::assertSame($importoPagamento, $dettaglioPagamento->ImportoPagamento); - self::assertSame($dataScadenzaPagamento, $dettaglioPagamento->DataScadenzaPagamento); - self::assertSame($dataRiferimentoTerminiPagamento, $dettaglioPagamento->DataRiferimentoTerminiPagamento); - self::assertSame($giorniTerminiPagamento, $dettaglioPagamento->GiorniTerminiPagamento); - self::assertSame($beneficiario, $dettaglioPagamento->Beneficiario); - self::assertSame($istitutoFinanziario, $dettaglioPagamento->IstituroFinanziario); - self::assertSame($iban, $dettaglioPagamento->IBAN); - self::assertSame($abi, $dettaglioPagamento->ABI); - self::assertSame($cab, $dettaglioPagamento->CAB); - self::assertSame($bic, $dettaglioPagamento->BIC); - self::assertSame($modalitaPagamento, $dettaglioPagamento->ModalitaPagamento); + $this->assertInstanceOf(DettaglioPagamento::class, $dettaglioPagamento); + $this->assertEquals($importoPagamento, $dettaglioPagamento->ImportoPagamento); + $this->assertEquals($dataScadenzaPagamento, $dettaglioPagamento->DataScadenzaPagamento); + $this->assertEquals($dataRiferimentoTerminiPagamento, $dettaglioPagamento->DataRiferimentoTerminiPagamento); + $this->assertEquals($giorniTerminiPagamento, $dettaglioPagamento->GiorniTerminiPagamento); + $this->assertEquals($beneficiario, $dettaglioPagamento->Beneficiario); + $this->assertEquals($istitutoFinanziario, $dettaglioPagamento->IstituroFinanziario); + $this->assertEquals($iban, $dettaglioPagamento->IBAN); + $this->assertEquals($abi, $dettaglioPagamento->ABI); + $this->assertEquals($cab, $dettaglioPagamento->CAB); + $this->assertEquals($bic, $dettaglioPagamento->BIC); + $this->assertEquals($modalitaPagamento, $dettaglioPagamento->ModalitaPagamento); } public function testConstructorWithoutIBAN(): void @@ -91,14 +74,14 @@ public function testConstructorWithoutIBAN(): void $modalitaPagamento ); - self::assertInstanceOf(DettaglioPagamento::class, $dettaglioPagamento); - self::assertSame($importoPagamento, $dettaglioPagamento->ImportoPagamento); - self::assertSame($dataScadenzaPagamento, $dettaglioPagamento->DataScadenzaPagamento); - self::assertSame($dataRiferimentoTerminiPagamento, $dettaglioPagamento->DataRiferimentoTerminiPagamento); - self::assertSame($giorniTerminiPagamento, $dettaglioPagamento->GiorniTerminiPagamento); - self::assertSame($beneficiario, $dettaglioPagamento->Beneficiario); - self::assertSame($istitutoFinanziario, $dettaglioPagamento->IstituroFinanziario); - self::assertSame($modalitaPagamento, $dettaglioPagamento->ModalitaPagamento); + $this->assertInstanceOf(DettaglioPagamento::class, $dettaglioPagamento); + $this->assertEquals($importoPagamento, $dettaglioPagamento->ImportoPagamento); + $this->assertEquals($dataScadenzaPagamento, $dettaglioPagamento->DataScadenzaPagamento); + $this->assertEquals($dataRiferimentoTerminiPagamento, $dettaglioPagamento->DataRiferimentoTerminiPagamento); + $this->assertEquals($giorniTerminiPagamento, $dettaglioPagamento->GiorniTerminiPagamento); + $this->assertEquals($beneficiario, $dettaglioPagamento->Beneficiario); + $this->assertEquals($istitutoFinanziario, $dettaglioPagamento->IstituroFinanziario); + $this->assertEquals($modalitaPagamento, $dettaglioPagamento->ModalitaPagamento); } public function testValidation(): void @@ -109,6 +92,6 @@ public function testValidation(): void $violations = $validator->validate($dettaglioPagamento); - self::assertCount(0, $violations); + $this->assertCount(0, $violations); } } diff --git a/tests/IdTest.php b/tests/IdTest.php index 8d7fef1..65c880c 100644 --- a/tests/IdTest.php +++ b/tests/IdTest.php @@ -1,17 +1,5 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\Id; @@ -19,12 +7,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -/** - * @internal - * - * @coversNothing - */ -final class IdTest extends TestCase +class IdTest extends TestCase { public function testConstructorWithIdPaese(): void { @@ -33,9 +16,9 @@ public function testConstructorWithIdPaese(): void $id = new Id($idCodice, $idPaese); - self::assertInstanceOf(Id::class, $id); - self::assertSame($idCodice, $id->IdCodice); - self::assertSame($idPaese, $id->IdPaese); + $this->assertInstanceOf(Id::class, $id); + $this->assertEquals($idCodice, $id->IdCodice); + $this->assertEquals($idPaese, $id->IdPaese); } public function testConstructorWithoutIdPaese(): void @@ -44,9 +27,9 @@ public function testConstructorWithoutIdPaese(): void $id = new Id($idCodice); - self::assertInstanceOf(Id::class, $id); - self::assertSame($idCodice, $id->IdCodice); - self::assertSame(Settings::IdPaeseDefault(), $id->IdPaese); + $this->assertInstanceOf(Id::class, $id); + $this->assertEquals($idCodice, $id->IdCodice); + $this->assertEquals(Settings::IdPaeseDefault(), $id->IdPaese); } public function testValidation(): void @@ -57,6 +40,6 @@ public function testValidation(): void $violations = $validator->validate($id); - self::assertCount(0, $violations); + $this->assertCount(0, $violations); } } diff --git a/tests/SedeTest.php b/tests/SedeTest.php index ded9198..b981387 100644 --- a/tests/SedeTest.php +++ b/tests/SedeTest.php @@ -1,17 +1,5 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - namespace Axiostudio\FatturaElettronica\Tests; use Axiostudio\FatturaElettronica\Models\Sede; @@ -19,12 +7,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -/** - * @internal - * - * @coversNothing - */ -final class SedeTest extends TestCase +class SedeTest extends TestCase { public function testConstructorWithProvinciaAndNazione(): void { @@ -36,12 +19,12 @@ public function testConstructorWithProvinciaAndNazione(): void $sede = new Sede($indirizzo, $cap, $comune, $provincia, $nazione); - self::assertInstanceOf(Sede::class, $sede); - self::assertSame($indirizzo, $sede->Indirizzo); - self::assertSame($cap, $sede->CAP); - self::assertSame($comune, $sede->Comune); - self::assertSame($provincia, $sede->Provincia); - self::assertSame($nazione, $sede->Nazione); + $this->assertInstanceOf(Sede::class, $sede); + $this->assertEquals($indirizzo, $sede->Indirizzo); + $this->assertEquals($cap, $sede->CAP); + $this->assertEquals($comune, $sede->Comune); + $this->assertEquals($provincia, $sede->Provincia); + $this->assertEquals($nazione, $sede->Nazione); } public function testConstructorWithoutProvinciaAndNazione(): void @@ -52,12 +35,12 @@ public function testConstructorWithoutProvinciaAndNazione(): void $sede = new Sede($indirizzo, $cap, $comune); - self::assertInstanceOf(Sede::class, $sede); - self::assertSame($indirizzo, $sede->Indirizzo); - self::assertSame($cap, $sede->CAP); - self::assertSame($comune, $sede->Comune); - self::assertNull($sede->Provincia); - self::assertSame(Settings::IdPaeseDefault(), $sede->Nazione); + $this->assertInstanceOf(Sede::class, $sede); + $this->assertEquals($indirizzo, $sede->Indirizzo); + $this->assertEquals($cap, $sede->CAP); + $this->assertEquals($comune, $sede->Comune); + $this->assertNull($sede->Provincia); + $this->assertEquals(Settings::IdPaeseDefault(), $sede->Nazione); } public function testValidation(): void @@ -68,6 +51,6 @@ public function testValidation(): void $violations = $validator->validate($sede); - self::assertCount(0, $violations); + $this->assertCount(0, $violations); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 6cf299c..9669a5c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,17 +1,8 @@ - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - use PHPUnit\Framework\TestCase as BaseTestCase; -abstract class TestCase extends BaseTestCase {} +abstract class TestCase extends BaseTestCase +{ + // +}