1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Onesky\Api\Tests; |
4
|
|
|
|
5
|
|
|
use Onesky\Api\Client; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class to test the translations resource. |
9
|
|
|
* |
10
|
|
|
* See more about translations resource here: |
11
|
|
|
* https://github.com/onesky/api-documentation-platform/blob/master/resources/translation.md |
12
|
|
|
* |
13
|
|
|
* @author Bernardo Silva <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class TranslationsApiTest extends \PHPUnit_Framework_TestCase |
16
|
|
|
{ |
17
|
|
|
/** @var \Onesky\Api\Client $api */ |
18
|
|
|
protected $api; |
19
|
|
|
|
20
|
|
|
public function setUp() |
21
|
|
|
{ |
22
|
|
|
$this->api = new Client(); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @expectedException \InvalidArgumentException |
27
|
|
|
* @expectedExceptionMessage Invalid resource action |
28
|
|
|
*/ |
29
|
|
|
public function testTranslationsDetectMissingResourceAction() |
30
|
|
|
{ |
31
|
|
|
$this->api->translations(); |
|
|
|
|
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @expectedException \InvalidArgumentException |
36
|
|
|
* @expectedExceptionMessage Missing parameter: project_id |
37
|
|
|
*/ |
38
|
|
|
public function testTranslationsExportDetectMissingParam() |
39
|
|
|
{ |
40
|
|
|
$this->api->translations('export'); |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @expectedException \UnexpectedValueException |
45
|
|
|
* @expectedExceptionMessage Invalid authenticate data of api key or secret |
46
|
|
|
*/ |
47
|
|
|
public function testTranslationsExportDetectInvalidAuthentication() |
48
|
|
|
{ |
49
|
|
|
$this->api->translations('export', ['project_id' => 123]); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @expectedException \InvalidArgumentException |
55
|
|
|
* @expectedExceptionMessage Missing parameter: project_id |
56
|
|
|
*/ |
57
|
|
|
public function testTranslationsStatusDetectMissingParam() |
58
|
|
|
{ |
59
|
|
|
$this->api->translations('status'); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @expectedException \UnexpectedValueException |
64
|
|
|
* @expectedExceptionMessage Invalid authenticate data of api key or secret |
65
|
|
|
*/ |
66
|
|
|
public function testTranslationsStatusDetectInvalidAuthentication() |
67
|
|
|
{ |
68
|
|
|
$this->api->translations('status', ['project_id' => 123]); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
} |
72
|
|
|
|