-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrea Pollastri
committed
Nov 13, 2023
1 parent
153f062
commit 5489cd7
Showing
5 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Axiostudio\FatturaElettronica\Tests; | ||
|
||
use Axiostudio\FatturaElettronica\Models\DatiBeniServizi; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DatiBeniServiziTest extends TestCase | ||
{ | ||
public function testConstructor(): void | ||
{ | ||
$datiBeniServizi = new DatiBeniServizi(); | ||
|
||
$this->assertInstanceOf(DatiBeniServizi::class, $datiBeniServizi); | ||
$this->assertNull($datiBeniServizi->XmlDatiBeniServizi); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Axiostudio\FatturaElettronica\Tests; | ||
|
||
use Axiostudio\FatturaElettronica\Models\DatiGeneraliDocumento; | ||
use Axiostudio\FatturaElettronica\Settings; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Validator\Validation; | ||
|
||
class DatiGeneraliDocumentoTest extends TestCase | ||
{ | ||
public function testConstructor(): void | ||
{ | ||
$numero = '123'; | ||
$data = '2023-11-13'; | ||
$importoTotaleDocumento = 123.45; | ||
|
||
$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); | ||
} | ||
|
||
public function testValidation(): void | ||
{ | ||
$datiGeneraliDocumento = new DatiGeneraliDocumento('123', '2023-11-13', 123.45); | ||
|
||
$validator = Validation::createValidatorBuilder()->enableAnnotationMapping()->getValidator(); | ||
|
||
$violations = $validator->validate($datiGeneraliDocumento); | ||
|
||
$this->assertCount(0, $violations); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Axiostudio\FatturaElettronica\Tests; | ||
|
||
use Axiostudio\FatturaElettronica\Models\DatiGenerali; | ||
use Axiostudio\FatturaElettronica\Models\DatiGeneraliDocumento; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DatiGeneraliTest extends TestCase | ||
{ | ||
public function testConstructor(): void | ||
{ | ||
$datiGeneraliDocumento = [ | ||
'1', | ||
'2019-01-01', | ||
'100.00', | ||
]; | ||
|
||
$datiGenerali = new DatiGenerali($datiGeneraliDocumento); | ||
|
||
$this->assertInstanceOf(DatiGenerali::class, $datiGenerali); | ||
$this->assertInstanceOf(DatiGeneraliDocumento::class, $datiGenerali->DatiGeneraliDocumento); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Axiostudio\FatturaElettronica\Tests; | ||
|
||
use Axiostudio\FatturaElettronica\Models\DettaglioPagamento; | ||
use Axiostudio\FatturaElettronica\Models\DatiPagamento; | ||
use Axiostudio\FatturaElettronica\Settings; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Validator\Validation; | ||
|
||
class DatiPagamentoTest extends TestCase | ||
{ | ||
public function testConstructor(): void | ||
{ | ||
$dettaglioPagamento = [100.00]; | ||
|
||
$datiPagamento = new DatiPagamento($dettaglioPagamento); | ||
|
||
$this->assertInstanceOf(DatiPagamento::class, $datiPagamento); | ||
$this->assertInstanceOf(DettaglioPagamento::class, $datiPagamento->DettaglioPagamento); | ||
$this->assertEquals(Settings::CondizioniPagamentoDefault(), $datiPagamento->CondizioniPagamento); | ||
} | ||
} |