Completed
Push — master ( 2ad0de...2fd600 )
by Levan
03:06
created

LanguageDetectionTest::testMultipleSentence()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Stichoza\GoogleTranslate\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use Stichoza\GoogleTranslate\GoogleTranslate;
7
8
class LanguageDetectionTest extends TestCase
9
{
10
    public $tr;
11
12
    public function setUp()
13
    {
14
        $this->tr = new GoogleTranslate();
15
    }
16
17 View Code Duplication
    public function testSingleWord()
0 ignored issues
show
Duplication introduced by
This method 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...
18
    {
19
        $this->tr->translate('გამარჯობა');
20
        $this->assertEquals($this->tr->getLastDetectedSource(), 'ka');
21
22
        $this->tr->translate('Cześć');
23
        $this->assertEquals($this->tr->getLastDetectedSource(), 'pl');
24
    }
25
26 View Code Duplication
    public function testSingleSentence()
0 ignored issues
show
Duplication introduced by
This method 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...
27
    {
28
        $this->tr->translate('იყო არაბეთს როსტევან');
29
        $this->assertEquals($this->tr->getLastDetectedSource(), 'ka');
30
31
        $this->tr->translate('Путин хуйло');
32
        $this->assertEquals($this->tr->getLastDetectedSource(), 'ru');
33
    }
34
35 View Code Duplication
    public function testMultipleSentence()
0 ignored issues
show
Duplication introduced by
This method 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...
36
    {
37
        $this->tr->translate('ჩემი ხატია სამშობლო. სახატე - მთელი ქვეყანა. განათებული მთა-ბარი.');
38
        $this->assertEquals($this->tr->getLastDetectedSource(), 'ka');
39
40
        $this->tr->translate('Ще не вмерла Україна, И слава, и воля! Ще намъ, браття-молодці, Усміхнеться доля!');
41
        $this->assertEquals($this->tr->getLastDetectedSource(), 'uk');
42
    }
43
}
44