Varios cambios Co-authored-by: Juan Pablo Vial <jpvialb@incoviba.cl> Reviewed-on: #25
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
namespace Tests\Unit\Model\Venta\MediosPago\Toku;
|
|
|
|
use Faker;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Incoviba\Model;
|
|
|
|
class InvoiceTest extends TestCase
|
|
{
|
|
public static function dataProperties(): array
|
|
{
|
|
return [
|
|
['id'],
|
|
['cuota'],
|
|
['toku_id'],
|
|
];
|
|
}
|
|
#[DataProvider('dataProperties')]
|
|
public function testProperties(string $propertyName): void
|
|
{
|
|
$invoice = new Model\Venta\MediosPago\Toku\Invoice();
|
|
$this->assertObjectHasProperty($propertyName, $invoice);
|
|
}
|
|
|
|
public function testJson(): void
|
|
{
|
|
$faker = Faker\Factory::create();
|
|
|
|
$cuota = $this->getMockBuilder(Model\Venta\Cuota::class)
|
|
->disableOriginalConstructor()->getMock();
|
|
$cuota->id = $faker->randomNumber();
|
|
|
|
$toku_id = $faker->ean13();
|
|
|
|
$id = $faker->randomNumber();
|
|
|
|
$invoice = new Model\Venta\MediosPago\Toku\Invoice();
|
|
$invoice->id = $id;
|
|
$invoice->cuota = $cuota;
|
|
$invoice->toku_id = $toku_id;
|
|
|
|
$expected = json_encode([
|
|
'id' => $id,
|
|
'cuota_id' => $cuota->id,
|
|
'toku_id' => $toku_id,
|
|
]);
|
|
$this->assertEquals($expected, json_encode($invoice));
|
|
}
|
|
}
|