1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stichoza\GoogleTranslate\Tests; |
4
|
|
|
|
5
|
|
|
use Stichoza\GoogleTranslate\TranslateClient; |
6
|
|
|
|
7
|
|
|
class TranslationTest extends \PHPUnit_Framework_TestCase |
|
|
|
|
8
|
|
|
{ |
9
|
|
|
public function setUp() |
10
|
|
|
{ |
11
|
|
|
$this->tr = new TranslateClient(); |
|
|
|
|
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function testTranslationEquality() |
15
|
|
|
{ |
16
|
|
|
$resultOne = TranslateClient::translate('en', 'ka', 'Hello'); |
|
|
|
|
17
|
|
|
$resultTwo = $this->tr->setSource('en')->setTarget('ka')->translate('Hello'); |
18
|
|
|
|
19
|
|
|
$this->assertEquals($resultOne, $resultTwo, 'გამარჯობა'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function testArrayTranslation() |
23
|
|
|
{ |
24
|
|
|
$this->tr->setSource('en')->setTarget('ka'); |
25
|
|
|
|
26
|
|
|
$resultCat = $this->tr->translate('cat'); |
27
|
|
|
$resultDog = $this->tr->translate('dog'); |
28
|
|
|
$resultFish = $this->tr->translate('fish'); |
29
|
|
|
|
30
|
|
|
$arrayResults = $this->tr->translate(['cat', 'dog', 'fish']); |
31
|
|
|
$arrayZesults = TranslateClient::translate('en', 'ka', ['cat', 'dog', 'fish']); |
|
|
|
|
32
|
|
|
|
33
|
|
|
$this->assertEquals($resultCat, $arrayResults[0], 'კატა'); |
34
|
|
|
$this->assertEquals($resultDog, $arrayResults[1], 'ძაღლი'); |
35
|
|
|
$this->assertEquals($resultFish, $arrayResults[2], 'თევზი'); |
36
|
|
|
|
37
|
|
|
$this->assertEquals($resultCat, $arrayZesults[0], 'კატა'); |
38
|
|
|
$this->assertEquals($resultDog, $arrayZesults[1], 'ძაღლი'); |
39
|
|
|
$this->assertEquals($resultFish, $arrayZesults[2], 'თევზი'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testRawResponse() |
43
|
|
|
{ |
44
|
|
|
$rawResult = $this->tr->getResponse('cat'); |
45
|
|
|
|
46
|
|
|
$this->assertTrue(is_array($rawResult), 'Method getResponse() should return an array.'); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths