FilesApiTest::testFilesListDetectMissingParam()   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 files resource.
9
 *
10
 * See more about files resource here:
11
 * https://github.com/onesky/api-documentation-platform/blob/master/resources/file.md
12
 *
13
 * @author Bernardo Silva <[email protected]>
14
 */
15
class FilesApiTest 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 testFilesDetectMissingResourceAction()
30
    {
31
        $this->api->files();
0 ignored issues
show
Bug introduced by
The call to files() 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 testFilesListDetectMissingParam()
39
    {
40
        $this->api->files('list');
0 ignored issues
show
Bug introduced by
The call to files() 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 testFilesListDetectInvalidAuthentication()
48
    {
49
        $this->api->files('list', ['project_id' => 123]);
50
    }
51
52
53
    /**
54
     * @expectedException \InvalidArgumentException
55
     * @expectedExceptionMessage Missing parameter: project_id
56
     */
57
    public function testFilesUploadDetectMissingParam()
58
    {
59
        $this->api->files('upload');
0 ignored issues
show
Bug introduced by
The call to files() 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 testFilesUploadDetectInvalidAuthentication()
67
    {
68
        $this->api->files('upload', ['project_id' => 123]);
69
    }
70
71
    /**
72
     * @expectedException \InvalidArgumentException
73
     * @expectedExceptionMessage Missing parameter: project_id
74
     */
75
    public function testFilesDeleteDetectMissingParam()
76
    {
77
        $this->api->files('delete');
0 ignored issues
show
Bug introduced by
The call to files() misses a required argument $arrayWithProjectId.

This check looks for function calls that miss required arguments.

Loading history...
78
    }
79
80
    /**
81
     * @expectedException \UnexpectedValueException
82
     * @expectedExceptionMessage Invalid authenticate data of api key or secret
83
     */
84
    public function testFilesDeleteDetectInvalidAuthentication()
85
    {
86
        $this->api->files('delete', ['project_id' => 123]);
87
    }
88
}
89