Files
kulakpos_web/vendor/fedapay/fedapay-php/tests/FedapayObjectTest.php
triagungbiantoro 417b7b7453
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m27s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 31s
Build, Push and Deploy / deploy-production (push) Has been skipped
harga pada beranda terhubung ke manage plans di dashboard admin
2026-04-25 21:57:25 +07:00

59 lines
1.7 KiB
PHP
Executable File

<?php
namespace Tests;
class FedaPayObjectTest extends BaseTestCase
{
/**
* Should set and get object attributes
*/
public function testShouldSetObjectAttribute()
{
$object = new \FedaPay\FedaPayObject;
$object->id = 1;
$object->name = 'name';
$this->assertEquals($object->id, 1);
$this->assertEquals($object['id'], 1);
$this->assertEquals($object->name, 'name');
$this->assertEquals($object['name'], 'name');
$object = new \FedaPay\FedaPayObject(2);
$this->assertEquals($object->id, 2);
$object = new \FedaPay\FedaPayObject(['foo' => 'value']);
$this->assertEquals($object->foo, 'value');
$this->assertTrue(isset($object->foo));
$this->assertTrue(isset($object['foo']));
$this->assertFalse(isset($object['doe']));
$this->assertFalse(isset($object->doe));
}
public function testShouldSerializeObject()
{
$object = new \FedaPay\FedaPayObject(['foo' => 'value']);
$json = json_encode($object);
$this->assertEquals($json, '{"foo":"value"}');
}
public function testShouldRefreshObject()
{
$object = new \FedaPay\FedaPayObject;
$object->refreshFrom(['foo' => 'value'], null);
$this->assertEquals($object->foo, 'value');
}
public function testShouldSerializeObjectParams()
{
$object = new \FedaPay\FedaPayObject;
$object->refreshFrom(['foo' => 'value', 'id' => 2], null);
$params = $object->serializeParameters();
$this->assertTrue(is_array($params));
$this->assertEquals($params['foo'], 'value');
$this->assertArrayNotHasKey('id', $params);
}
}