Completed
Push — develop ( 98b532...40efcd )
by Adrien
27:48
created

NumberFormatTest::providerNumberFormat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Style;
4
5
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
6
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
7
use PHPUnit_Framework_TestCase;
8
9
class NumberFormatTest extends PHPUnit_Framework_TestCase
10
{
11
    public function setUp()
12
    {
13
        StringHelper::setDecimalSeparator('.');
14
        StringHelper::setThousandsSeparator(',');
15
    }
16
17
    /**
18
     * @dataProvider providerNumberFormat
19
     *
20
     * @param mixed $expectedResult
21
     */
22
    public function testFormatValueWithMask($expectedResult, ...$args)
23
    {
24
        $result = NumberFormat::toFormattedString(...$args);
0 ignored issues
show
Bug introduced by
The call to toFormattedString() misses a required argument $format.

This check looks for function calls that miss required arguments.

Loading history...
25
        self::assertEquals($expectedResult, $result);
26
    }
27
28
    public function providerNumberFormat()
29
    {
30
        return require 'data/Style/NumberFormat.php';
31
    }
32
33
    /**
34
     * @dataProvider providerNumberFormatDates
35
     *
36
     * @param mixed $expectedResult
37
     */
38
    public function testFormatValueWithMaskDate($expectedResult, ...$args)
39
    {
40
        $result = NumberFormat::toFormattedString(...$args);
0 ignored issues
show
Bug introduced by
The call to toFormattedString() misses a required argument $format.

This check looks for function calls that miss required arguments.

Loading history...
41
        self::assertEquals($expectedResult, $result);
42
    }
43
44
    public function providerNumberFormatDates()
45
    {
46
        return require 'data/Style/NumberFormatDates.php';
47
    }
48
}
49