CurrencyTraitTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
c 0
b 0
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMoneyHTMLFormat() 0 7 1
A dataMoneyHTMLFormat() 0 7 1
1
<?php
2
3
namespace ByTIC\Payments\Tests\Models\Currencies\Traits;
4
5
use Paytic\Payments\Tests\AbstractTest;
6
use Paytic\Payments\Tests\Fixtures\Records\Currencies\Currency;
7
8
/**
9
 * Class CurrencyTraitTest
10
 * @package ByTIC\Payments\Tests\Models\Currencies\Traits
11
 */
12
class CurrencyTraitTest extends AbstractTest
13
{
14
    /**
15
     * @param $amount
16
     * @dataProvider dataMoneyHTMLFormat
17
     */
18
    public function testMoneyHTMLFormat($amount, $htmlExpected)
19
    {
20
        $currency = new Currency();
21
        $currency->code = 'RON';
22
        $currency->symbol = 'lei';
23
24
        self::assertSame($htmlExpected, $currency->moneyHTMLFormat($amount));
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    public function dataMoneyHTMLFormat()
31
    {
32
        return [
33
            ['200.789','<span class="price" content="200.789"><span class="money-int">200</span><sup class="money-decimal">.79</sup> <span class="money-currency">lei</span></span>'],
34
            ['200.749','<span class="price" content="200.749"><span class="money-int">200</span><sup class="money-decimal">.75</sup> <span class="money-currency">lei</span></span>'],
35
            ['200.744','<span class="price" content="200.744"><span class="money-int">200</span><sup class="money-decimal">.74</sup> <span class="money-currency">lei</span></span>'],
36
            ['200','<span class="price" content="200"><span class="money-int">200</span><sup class="money-decimal">.00</sup> <span class="money-currency">lei</span></span>'],
37
        ];
38
    }
39
}
40