You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
979 B
37 lines
979 B
<?php
|
|
|
|
namespace Tests\Unit\Helpers;
|
|
|
|
use Tests\TestCase;
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
|
|
/**
|
|
* Money Format Helper Unit Test.
|
|
*
|
|
* @author Nafies Luthfi <nafiesL@gmail.com>
|
|
*/
|
|
class MoneyFormatTest extends TestCase
|
|
{
|
|
use DatabaseMigrations;
|
|
|
|
/** @test */
|
|
public function format_money_returns_string_with_default_money_sign()
|
|
{
|
|
$this->assertEquals('Rp. 1.000', format_money(1000));
|
|
$this->assertEquals('Rp. 0', format_money(0));
|
|
$this->assertEquals('- Rp. 1.000', format_money(-1000));
|
|
}
|
|
|
|
/** @test */
|
|
public function format_money_returns_string_based_on_site_option_money_sign()
|
|
{
|
|
\DB::table('site_options')->insert([
|
|
'key' => 'money_sign',
|
|
'value' => 'USD',
|
|
]);
|
|
|
|
$this->assertEquals('USD 1.000', format_money(1000));
|
|
$this->assertEquals('USD 0', format_money(0));
|
|
$this->assertEquals('- USD 1.000', format_money(-1000));
|
|
}
|
|
}
|