develop (#45)
Co-authored-by: Juan Pablo Vial <jpvialb@incoviba.cl> Reviewed-on: #45
This commit is contained in:
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Tests\Unit\Model\Venta\MediosPago\Toku;
|
||||
|
||||
use Faker;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Incoviba\Model;
|
||||
|
||||
class SubscriptionTest extends TestCase
|
||||
{
|
||||
public static function dataProperties(): array
|
||||
{
|
||||
return [
|
||||
['id'],
|
||||
['venta'],
|
||||
['toku_id'],
|
||||
];
|
||||
}
|
||||
#[DataProvider('dataProperties')]
|
||||
public function testProperties(string $propertyName): void
|
||||
{
|
||||
$subscription = new Model\Venta\MediosPago\Toku\Subscription();
|
||||
$this->assertObjectHasProperty($propertyName, $subscription);
|
||||
}
|
||||
|
||||
public function testJson(): void
|
||||
{
|
||||
$faker = Faker\Factory::create();
|
||||
|
||||
$venta = $this->getMockBuilder(Model\Venta::class)->disableOriginalConstructor()->getMock();
|
||||
$venta->id = $faker->randomNumber();
|
||||
|
||||
$toku_id = $faker->ean13();
|
||||
|
||||
$id = $faker->randomNumber();
|
||||
|
||||
$subscription = new Model\Venta\MediosPago\Toku\Subscription();
|
||||
$subscription->id = $id;
|
||||
$subscription->venta = $venta;
|
||||
$subscription->toku_id = $toku_id;
|
||||
|
||||
$expected = json_encode([
|
||||
'id' => $id,
|
||||
'venta_id' => $venta->id,
|
||||
'toku_id' => $toku_id,
|
||||
]);
|
||||
$this->assertEquals($expected, json_encode($subscription));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user