Files
oficial/app/tests/unit/src/Model/Venta/MediosPago/Toku/SubscriptionTest.php

50 lines
1.3 KiB
PHP
Raw Normal View History

<?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));
}
}