CountryExtensionTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Mero\Bundle\BaseBundle\Tests\Twig;
4
5
use Mero\Bundle\BaseBundle\Twig\CountryExtension;
6
7 View Code Duplication
class CountryExtensionTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * @var CountryExtension
11
     */
12
    protected $extension;
13
14
    protected function setUp()
15
    {
16
        $this->extension = new CountryExtension();
17
    }
18
19
    public static function dataProvider()
20
    {
21
        return [
22
            ['US', 'pt_BR', 'Estados Unidos'],
23
            ['US', 'en_US', 'United States'],
24
            ['ES', 'pt_BR', 'Espanha'],
25
            ['ES', 'en_US', 'Spain'],
26
            ['PT', 'pt_BR', 'Portugal'],
27
            ['PT', 'en_US', 'Portugal'],
28
            ['BR', 'pt_BR', 'Brasil'],
29
            ['BR', 'en_US', 'Brazil'],
30
        ];
31
    }
32
33
    public function testEmptyCountryIso()
34
    {
35
        $output = $this->extension->getCountryName(null, 'pt_BR');
36
        $this->assertEmpty($output);
37
    }
38
39
    /**
40
     * @dataProvider dataProvider
41
     */
42
    public function testGetCountryName($countryIso, $locale, $expected)
43
    {
44
        $output = $this->extension->getCountryName($countryIso, $locale);
45
        $this->assertEquals($expected, $output);
46
    }
47
}
48