Files
kulakpos_web/vendor/fedapay/fedapay-php/tests/EventTest.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

69 lines
2.1 KiB
PHP
Executable File

<?php
namespace Tests;
class EventTest extends BaseTestCase
{
/**
* Should return array of FedaPay\Event
*/
public function testShouldReturnEvents()
{
$body = [
'v1/events' => [[
'id' => 1,
'klass' => 'v1/event',
'type' => 'transaction.update',
'entity' => [],
'object_id' => 1,
'account_id' => 1,
'created_at' => '2018-03-12T09:09:03.969Z',
'updated_at' => '2018-03-12T09:09:03.969Z'
]],
'meta' => ['page' => 1]
];
$this->mockRequest('get', '/v1/events', [], $body);
$object = \FedaPay\Event::all();
$this->assertInstanceOf(\FedaPay\FedaPayObject::class, $object);
$this->assertInstanceOf(\FedaPay\FedaPayObject::class, $object->meta);
$this->assertTrue(is_array($object->events));
$this->assertInstanceOf(\FedaPay\Event::class, $object->events[0]);
$this->assertEquals(1, $object->events[0]->id);
$this->assertEquals('transaction.update', $object->events[0]->type);
$this->assertEquals(1, $object->events[0]->object_id);
$this->assertEquals(1, $object->events[0]->account_id);
}
/**
* Should retrieve a Event
*/
public function testShouldRetrievedAEvent()
{
$body = [
'v1/event' => [
'id' => 1,
'klass' => 'v1/event',
'type' => 'transaction.update',
'entity' => [],
'object_id' => 1,
'account_id' => 1,
'created_at' => '2018-03-12T09:09:03.969Z',
'updated_at' => '2018-03-12T09:09:03.969Z'
]
];
$this->mockRequest('get', '/v1/events/1', [], $body);
$event = \FedaPay\Event::retrieve(1);
$this->assertInstanceOf(\FedaPay\Event::class, $event);
$this->assertEquals(1, $event->id);
$this->assertEquals('transaction.update', $event->type);
$this->assertEquals(1, $event->object_id);
$this->assertEquals(1, $event->account_id);
}
}