Passed
Push — master ( d657dc...438755 )
by Alex
07:49
created

sendRequestDataProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 8
rs 10
cc 1
nc 1
nop 0
1
<?php
2
namespace Mezon\CustomClient\Tests;
3
4
class CustomClientTraitUnitTest extends BaseTestUtilities
5
{
6
7
    /**
8
     * Data provider for sending requests tests
9
     *
10
     * @return array test data
11
     */
12
    public function sendRequestDataProvider(): array
13
    {
14
        return [
15
            [
16
                'sendPutRequest'
17
            ],
18
            [
19
                'sendDeleteRequest'
20
            ]
21
        ];
22
    }
23
24
    /**
25
     * Testing sendGetRequest method
26
     *
27
     * @param string $methodName
28
     *            Method name to be tested
29
     * @dataProvider sendRequestDataProvider
30
     */
31
    public function testSendRequest(string $methodName): void
32
    {
33
        // setup
34
        $client = $this->getMock([
35
            'sendPostRequest'
36
        ]);
37
        $client->method('sendPostRequest')->willReturn([
38
            'return',
39
            1
40
        ]);
41
        $client->setPutTraitMethod(true);
42
        $client->setDeleteTraitMethod(true);
43
44
        // test body
45
        $result = $client->$methodName('/end-point/');
46
47
        // assertions
48
        $this->assertEquals('return', $result[0]);
49
    }
50
}
51