1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NStack\Tests; |
4
|
|
|
|
5
|
|
|
use NStack\Clients\LanguagesClient; |
6
|
|
|
use NStack\Clients\LocalizeClient; |
7
|
|
|
use NStack\Models\Language; |
8
|
|
|
|
9
|
|
|
class LanguageTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
public function testResourceIndex() |
12
|
|
|
{ |
13
|
|
|
$client = $this->getClientWithMockedGet('languages-index.json'); |
14
|
|
|
|
15
|
|
|
$client = new LanguagesClient($this->getConfig(), $client); |
16
|
|
|
$list = $client->index(); |
17
|
|
|
|
18
|
|
|
foreach ($list as $language) { |
19
|
|
|
$this->assertInstanceOf(Language::class, $language); |
20
|
|
|
} |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function testResourceSearch() |
24
|
|
|
{ |
25
|
|
|
$client = $this->getClientWithMockedGet('languages-search.json'); |
26
|
|
|
|
27
|
|
|
$client = new LanguagesClient($this->getConfig(), $client); |
28
|
|
|
$list = $client->search("br"); |
29
|
|
|
|
30
|
|
|
foreach ($list as $language) { |
31
|
|
|
$this->assertInstanceOf(Language::class, $language); |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testLanguagesIndex() |
36
|
|
|
{ |
37
|
|
|
$client = $this->getClientWithMockedGet('localize-languages-index.json'); |
38
|
|
|
|
39
|
|
|
$client = new LocalizeClient($this->getConfig(), $client); |
40
|
|
|
$list = $client->indexLanguage('mobile'); |
41
|
|
|
|
42
|
|
|
foreach ($list as $continent) { |
43
|
|
|
$this->assertInstanceOf(Language::class, $continent); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function testLanguagesBestFit() |
48
|
|
|
{ |
49
|
|
|
$client = $this->getClientWithMockedGet('localize-languages-best-fit.json'); |
50
|
|
|
|
51
|
|
|
$client = new LocalizeClient($this->getConfig(), $client); |
52
|
|
|
$language = $client->bestFitLanguage('mobile'); |
53
|
|
|
|
54
|
|
|
$this->assertInstanceOf(Language::class, $language); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|