testTranslationsStatusDetectMissingParam()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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();
0 ignored issues
show
Bug introduced by
The call to translations() misses some required arguments starting with $action.
Loading history...
32
    }
33
34
    /**
35
     * @expectedException \InvalidArgumentException
36
     * @expectedExceptionMessage Missing parameter: project_id
37
     */
38
    public function testTranslationsExportDetectMissingParam()
39
    {
40
        $this->api->translations('export');
0 ignored issues
show
Bug introduced by
The call to translations() misses a required argument $arrayWithProjectId.

This check looks for function calls that miss required arguments.

Loading history...
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');
0 ignored issues
show
Bug introduced by
The call to translations() misses a required argument $arrayWithProjectId.

This check looks for function calls that miss required arguments.

Loading history...
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