diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index da272ea..3556d07 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -3,30 +3,31 @@ 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 cc75810..1534f64 100644 --- a/test-temp.php +++ b/test-temp.php @@ -1,6 +1,18 @@ + * 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'; use Axiostudio\FatturaElettronica\FatturaElettronica; @@ -21,7 +33,7 @@ $header = [ $datiTrasmissione, $cedentePrestatore, - $cessionarioCommittente + $cessionarioCommittente, ]; $datiGeneraliDocumento = ['123', '2021-01-01', '345.22']; @@ -34,7 +46,7 @@ $body = [ $datiGenerali, - $datiDatiPagamento + $datiDatiPagamento, ]; $dettaglioLinee = [ @@ -54,9 +66,9 @@ var_dump($datiXml); -/* +/* $data = [ - + 'FatturaElettronicaBody' => [ 'DatiGenerali' => [ 'DatiGeneraliDocumento' => [ @@ -101,4 +113,4 @@ ] ] ]; -*/ \ No newline at end of file +*/ diff --git a/tests/AnagraficaTest.php b/tests/AnagraficaTest.php index 0360a54..aad7203 100644 --- a/tests/AnagraficaTest.php +++ b/tests/AnagraficaTest.php @@ -1,11 +1,28 @@ + * 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; -class AnagraficaTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class AnagraficaTest extends TestCase { public function testConstructor(): void { @@ -15,9 +32,9 @@ public function testConstructor(): void $anagrafica = new Anagrafica($denominazione, $nome, $cognome); - $this->assertInstanceOf(Anagrafica::class, $anagrafica); - $this->assertEquals($denominazione, $anagrafica->Denominazione); - $this->assertEquals($nome, $anagrafica->Nome); - $this->assertEquals($cognome, $anagrafica->Cognome); + self::assertInstanceOf(Anagrafica::class, $anagrafica); + self::assertSame($denominazione, $anagrafica->Denominazione); + self::assertSame($nome, $anagrafica->Nome); + self::assertSame($cognome, $anagrafica->Cognome); } } diff --git a/tests/CedentePrestatoreTest.php b/tests/CedentePrestatoreTest.php index 2f15c47..243064d 100644 --- a/tests/CedentePrestatoreTest.php +++ b/tests/CedentePrestatoreTest.php @@ -1,30 +1,46 @@ + * 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 PHPUnit\Framework\TestCase; -use Axiostudio\FatturaElettronica\Models\Sede; -use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; use Axiostudio\FatturaElettronica\Models\CedentePrestatore; +use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; +use Axiostudio\FatturaElettronica\Models\Sede; +use PHPUnit\Framework\TestCase; -class CedentePrestatoreTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final 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); - $this->assertInstanceOf(CedentePrestatore::class, $cedentePrestatore); - $this->assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); - $this->assertInstanceOf(Sede::class, $cedentePrestatore->Sede); + self::assertInstanceOf(CedentePrestatore::class, $cedentePrestatore); + self::assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); + self::assertInstanceOf(Sede::class, $cedentePrestatore->Sede); } } diff --git a/tests/CessionarioCommittente.php b/tests/CessionarioCommittente.php index 0463dfc..0d1f95c 100644 --- a/tests/CessionarioCommittente.php +++ b/tests/CessionarioCommittente.php @@ -1,30 +1,46 @@ + * 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 PHPUnit\Framework\TestCase; -use Axiostudio\FatturaElettronica\Models\Sede; -use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; use Axiostudio\FatturaElettronica\Models\CessionarioCommittente; +use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; +use Axiostudio\FatturaElettronica\Models\Sede; +use PHPUnit\Framework\TestCase; -class CessionarioCommittenteTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class CessionarioCommittente extends TestCase { public function testConstructor(): void { - $DatiAnagrafici = ['Company Ltd', '0123456789']; $Sede = [ 'Via Roma, 1', '00100', 'Roma', 'RM', - 'IT' + 'IT', ]; - $cedentePrestatore = new CessionarioCommittente($DatiAnagrafici, $Sede); + $cedentePrestatore = new self($DatiAnagrafici, $Sede); - $this->assertInstanceOf(CessionarioCommittente::class, $cedentePrestatore); - $this->assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); - $this->assertInstanceOf(Sede::class, $cedentePrestatore->Sede); + self::assertInstanceOf(self::class, $cedentePrestatore); + self::assertInstanceOf(DatiAnagrafici::class, $cedentePrestatore->DatiAnagrafici); + self::assertInstanceOf(Sede::class, $cedentePrestatore->Sede); } } diff --git a/tests/DatiAnagraficiTest.php b/tests/DatiAnagraficiTest.php index 0878046..3c09b63 100644 --- a/tests/DatiAnagraficiTest.php +++ b/tests/DatiAnagraficiTest.php @@ -1,13 +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\Anagrafica; use Axiostudio\FatturaElettronica\Models\DatiAnagrafici; use Axiostudio\FatturaElettronica\Models\Id; -use Axiostudio\FatturaElettronica\Models\Anagrafica; use PHPUnit\Framework\TestCase; -class DatiAnagraficiTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiAnagraficiTest extends TestCase { public function testConstructor(): void { @@ -19,10 +36,10 @@ public function testConstructor(): void $datiAnagrafici = new DatiAnagrafici($id, $anagrafica, $codiceFiscale, $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); + 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); } } diff --git a/tests/DatiBeniservizi.php b/tests/DatiBeniservizi.php index 53aa212..c0e9a1e 100644 --- a/tests/DatiBeniservizi.php +++ b/tests/DatiBeniservizi.php @@ -1,17 +1,34 @@ + * 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; -class DatiBeniServiziTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiBeniservizi extends TestCase { public function testConstructor(): void { - $datiBeniServizi = new DatiBeniServizi(); + $datiBeniServizi = new self(); - $this->assertInstanceOf(DatiBeniServizi::class, $datiBeniServizi); - $this->assertNull($datiBeniServizi->XmlDatiBeniServizi); + self::assertInstanceOf(self::class, $datiBeniServizi); + self::assertNull($datiBeniServizi->XmlDatiBeniServizi); } } diff --git a/tests/DatiGeneraliDocumentoTest.php b/tests/DatiGeneraliDocumentoTest.php index 0ce884e..947c408 100644 --- a/tests/DatiGeneraliDocumentoTest.php +++ b/tests/DatiGeneraliDocumentoTest.php @@ -1,5 +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\DatiGeneraliDocumento; @@ -7,7 +19,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -class DatiGeneraliDocumentoTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiGeneraliDocumentoTest extends TestCase { public function testConstructor(): void { @@ -17,13 +34,13 @@ public function testConstructor(): void $datiGeneraliDocumento = new DatiGeneraliDocumento($numero, $data, $importoTotaleDocumento); - $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); + 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); } public function testValidation(): void @@ -34,6 +51,6 @@ public function testValidation(): void $violations = $validator->validate($datiGeneraliDocumento); - $this->assertCount(0, $violations); + self::assertCount(0, $violations); } } diff --git a/tests/DatiGeneraliTest.php b/tests/DatiGeneraliTest.php index a681ca0..f47614c 100644 --- a/tests/DatiGeneraliTest.php +++ b/tests/DatiGeneraliTest.php @@ -1,12 +1,29 @@ + * 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; -class DatiGeneraliTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiGeneraliTest extends TestCase { public function testConstructor(): void { @@ -18,7 +35,7 @@ public function testConstructor(): void $datiGenerali = new DatiGenerali($datiGeneraliDocumento); - $this->assertInstanceOf(DatiGenerali::class, $datiGenerali); - $this->assertInstanceOf(DatiGeneraliDocumento::class, $datiGenerali->DatiGeneraliDocumento); + self::assertInstanceOf(DatiGenerali::class, $datiGenerali); + self::assertInstanceOf(DatiGeneraliDocumento::class, $datiGenerali->DatiGeneraliDocumento); } } diff --git a/tests/DatiPagamentoTest.php b/tests/DatiPagamentoTest.php index 30e884d..a284175 100644 --- a/tests/DatiPagamentoTest.php +++ b/tests/DatiPagamentoTest.php @@ -1,13 +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\DettaglioPagamento; use Axiostudio\FatturaElettronica\Models\DatiPagamento; +use Axiostudio\FatturaElettronica\Models\DettaglioPagamento; use Axiostudio\FatturaElettronica\Settings; use PHPUnit\Framework\TestCase; -class DatiPagamentoTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiPagamentoTest extends TestCase { public function testConstructor(): void { @@ -15,8 +32,8 @@ public function testConstructor(): void $datiPagamento = new DatiPagamento($dettaglioPagamento); - $this->assertInstanceOf(DatiPagamento::class, $datiPagamento); - $this->assertInstanceOf(DettaglioPagamento::class, $datiPagamento->DettaglioPagamento); - $this->assertEquals(Settings::CondizioniPagamentoDefault(), $datiPagamento->CondizioniPagamento); + self::assertInstanceOf(DatiPagamento::class, $datiPagamento); + self::assertInstanceOf(DettaglioPagamento::class, $datiPagamento->DettaglioPagamento); + self::assertSame(Settings::CondizioniPagamentoDefault(), $datiPagamento->CondizioniPagamento); } } diff --git a/tests/DatiRiepilogoTest.php b/tests/DatiRiepilogoTest.php index 0908e07..b7a8218 100644 --- a/tests/DatiRiepilogoTest.php +++ b/tests/DatiRiepilogoTest.php @@ -1,11 +1,28 @@ + * 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; -class DatiRiepilogoTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiRiepilogoTest extends TestCase { public function testConstructorWithNatura(): void { @@ -15,10 +32,10 @@ public function testConstructorWithNatura(): void $datiRiepilogo = new DatiRiepilogo($imponibileImporto, $aliquotaIVA, $natura); - $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); + 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); } } diff --git a/tests/DatiTrasmissioneTest.php b/tests/DatiTrasmissioneTest.php index f87b9fe..e520b42 100644 --- a/tests/DatiTrasmissioneTest.php +++ b/tests/DatiTrasmissioneTest.php @@ -1,5 +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\DatiTrasmissione; @@ -7,7 +19,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -class DatiTrasmissioneTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DatiTrasmissioneTest extends TestCase { public function testConstructorWithEmailPECDestinatario(): void { @@ -20,12 +37,12 @@ public function testConstructorWithEmailPECDestinatario(): void $datiTrasmissione = new DatiTrasmissione($id, $progressivoInvio, $codiceDestinatario, $pecDestinatario, $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); + 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); } public function testConstructorWithoutEmailPECDestinatario(): void @@ -38,11 +55,11 @@ public function testConstructorWithoutEmailPECDestinatario(): void $datiTrasmissione = new DatiTrasmissione($id, $progressivoInvio, $codiceDestinatario, null, $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); + 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); } public function testValidation(): void @@ -55,6 +72,6 @@ public function testValidation(): void $violations = $validator->validate($datiTrasmissione); - $this->assertCount(0, $violations); + self::assertCount(0, $violations); } } diff --git a/tests/DettaglioLineeTest.php b/tests/DettaglioLineeTest.php index 2038770..1981c73 100644 --- a/tests/DettaglioLineeTest.php +++ b/tests/DettaglioLineeTest.php @@ -1,12 +1,29 @@ + * 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; -class DettaglioLineeTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DettaglioLineeTest extends TestCase { public function testConstructorWithNatura(): void { @@ -19,14 +36,14 @@ public function testConstructorWithNatura(): void $dettaglioLinee = new DettaglioLinee($descrizione, $prezzoUnitario, $quantita, $unitaMisura, $aliquotaIVA, $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); + 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); } public function testConstructorWithoutNatura(): void @@ -39,13 +56,13 @@ public function testConstructorWithoutNatura(): void $dettaglioLinee = new DettaglioLinee($descrizione, $prezzoUnitario, $quantita, $unitaMisura, $aliquotaIVA); - $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); + 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); } public function testValidation(): void @@ -56,6 +73,6 @@ public function testValidation(): void $violations = $validator->validate($dettaglioLinee); - $this->assertCount(0, $violations); + self::assertCount(0, $violations); } } diff --git a/tests/DettaglioPagamentoTest.php b/tests/DettaglioPagamentoTest.php index d57c139..2845deb 100644 --- a/tests/DettaglioPagamentoTest.php +++ b/tests/DettaglioPagamentoTest.php @@ -1,12 +1,29 @@ + * 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; -class DettaglioPagamentoTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class DettaglioPagamentoTest extends TestCase { public function testConstructorWithIBAN(): void { @@ -36,18 +53,18 @@ public function testConstructorWithIBAN(): void $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); + 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); } public function testConstructorWithoutIBAN(): void @@ -74,14 +91,14 @@ public function testConstructorWithoutIBAN(): void $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); + 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); } public function testValidation(): void @@ -92,6 +109,6 @@ public function testValidation(): void $violations = $validator->validate($dettaglioPagamento); - $this->assertCount(0, $violations); + self::assertCount(0, $violations); } } diff --git a/tests/IdTest.php b/tests/IdTest.php index 65c880c..8d7fef1 100644 --- a/tests/IdTest.php +++ b/tests/IdTest.php @@ -1,5 +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\Id; @@ -7,7 +19,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -class IdTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class IdTest extends TestCase { public function testConstructorWithIdPaese(): void { @@ -16,9 +33,9 @@ public function testConstructorWithIdPaese(): void $id = new Id($idCodice, $idPaese); - $this->assertInstanceOf(Id::class, $id); - $this->assertEquals($idCodice, $id->IdCodice); - $this->assertEquals($idPaese, $id->IdPaese); + self::assertInstanceOf(Id::class, $id); + self::assertSame($idCodice, $id->IdCodice); + self::assertSame($idPaese, $id->IdPaese); } public function testConstructorWithoutIdPaese(): void @@ -27,9 +44,9 @@ public function testConstructorWithoutIdPaese(): void $id = new Id($idCodice); - $this->assertInstanceOf(Id::class, $id); - $this->assertEquals($idCodice, $id->IdCodice); - $this->assertEquals(Settings::IdPaeseDefault(), $id->IdPaese); + self::assertInstanceOf(Id::class, $id); + self::assertSame($idCodice, $id->IdCodice); + self::assertSame(Settings::IdPaeseDefault(), $id->IdPaese); } public function testValidation(): void @@ -40,6 +57,6 @@ public function testValidation(): void $violations = $validator->validate($id); - $this->assertCount(0, $violations); + self::assertCount(0, $violations); } } diff --git a/tests/SedeTest.php b/tests/SedeTest.php index b981387..ded9198 100644 --- a/tests/SedeTest.php +++ b/tests/SedeTest.php @@ -1,5 +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\Sede; @@ -7,7 +19,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Validation; -class SedeTest extends TestCase +/** + * @internal + * + * @coversNothing + */ +final class SedeTest extends TestCase { public function testConstructorWithProvinciaAndNazione(): void { @@ -19,12 +36,12 @@ public function testConstructorWithProvinciaAndNazione(): void $sede = new Sede($indirizzo, $cap, $comune, $provincia, $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); + 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); } public function testConstructorWithoutProvinciaAndNazione(): void @@ -35,12 +52,12 @@ public function testConstructorWithoutProvinciaAndNazione(): void $sede = new Sede($indirizzo, $cap, $comune); - $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); + 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); } public function testValidation(): void @@ -51,6 +68,6 @@ public function testValidation(): void $violations = $validator->validate($sede); - $this->assertCount(0, $violations); + self::assertCount(0, $violations); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 9669a5c..6cf299c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,8 +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. + */ + use PHPUnit\Framework\TestCase as BaseTestCase; -abstract class TestCase extends BaseTestCase -{ - // -} +abstract class TestCase extends BaseTestCase {}