Code Duplication    Length = 41-41 lines in 2 locations

Tests/Twig/CountryExtensionTest.php 1 location

@@ 7-47 (lines=41) @@
4
5
use Mero\Bundle\BaseBundle\Twig\CountryExtension;
6
7
class CountryExtensionTest extends \PHPUnit_Framework_TestCase
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

Tests/Twig/LanguageExtensionTest.php 1 location

@@ 7-47 (lines=41) @@
4
5
use Mero\Bundle\BaseBundle\Twig\LanguageExtension;
6
7
class LanguageExtensionTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * @var LanguageExtension
11
     */
12
    protected $extension;
13
14
    protected function setUp()
15
    {
16
        $this->extension = new LanguageExtension();
17
    }
18
19
    public static function dataProvider()
20
    {
21
        return [
22
            ['en', 'pt_BR', 'inglês'],
23
            ['en', 'en_US', 'English'],
24
            ['en_US', 'pt_BR', 'inglês americano'],
25
            ['en_US', 'en_US', 'American English'],
26
            ['es', 'pt_BR', 'espanhol'],
27
            ['es', 'en_US', 'Spanish'],
28
            ['es_ES', 'pt_BR', 'espanhol europeu'],
29
            ['es_ES', 'en_US', 'European Spanish'],
30
        ];
31
    }
32
33
    public function testEmptyLanguageIso()
34
    {
35
        $output = $this->extension->getLanguageName(null, 'pt_BR');
36
        $this->assertEmpty($output);
37
    }
38
39
    /**
40
     * @dataProvider dataProvider
41
     */
42
    public function testGetLanguageName($languageIso, $locale, $expected)
43
    {
44
        $output = $this->extension->getLanguageName($languageIso, $locale);
45
        $this->assertEquals($expected, $output);
46
    }
47
}
48