Files
kulakpos_web/vendor/mercadopago/dx-php/tests/resources/PreferenceTest.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

48 lines
1.2 KiB
PHP
Executable File

<?php
/**
* EntityTest Class Doc Comment
*
* @package MercadoPago
*/
class PreferenceTest extends \PHPUnit\Framework\TestCase
{
private static $last_preference;
public static function setUpBeforeClass()
{
if (file_exists(__DIR__ . '/../../.env')) {
$dotenv = new Dotenv\Dotenv(__DIR__, '../../.env');
$dotenv->load();
}
MercadoPago\SDK::setAccessToken(getenv('ACCESS_TOKEN'));
}
public function testCreatePrefence()
{
$preference = new MercadoPago\Preference();
# Building an item
$item = new MercadoPago\Item();
$item->title = "item";
$item->quantity = 1;
$item->unit_price = 100;
$preference->items = array($item);
$preference->expiration_date_to = new DateTime('tomorrow');
$preference->save();
self::$last_preference = $preference;
$this->assertTrue($preference->sandbox_init_point != null);
}
public function testFindPreferenceById(){
$preference = MercadoPago\Preference::find_by_id(self::$last_preference->id);
$this->assertEquals($preference->id, self::$last_preference->id);
}
}
?>