Failed Conditions
Push — master ( 4f9353...7eeb29 )
by Michel
02:37
created

ApiTest::testaddWorkLogEntry()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 25
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace TogglJiraTest\Jira;
5
6
use chobie\Jira\Api\Authentication\AuthenticationInterface;
7
use chobie\Jira\Api\Client\ClientInterface;
8
use chobie\Jira\Api\Result;
9
use PHPUnit\Framework\TestCase;
10
use TogglJira\Jira\Api;
11
12
class ApiTest extends TestCase
13
{
14
    /**
15
     * @return void
16
     */
17
    public function testaddWorkLogEntry(): void
18
    {
19
        $endPoint = 'http://www.example.com';
20
21
        $authenticationMock = \Mockery::mock(AuthenticationInterface::class);
1 ignored issue
show
Bug introduced by
chobie\Jira\Api\Authenti...icationInterface::class of type string is incompatible with the type array expected by parameter $args of Mockery::mock(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        $authenticationMock = \Mockery::mock(/** @scrutinizer ignore-type */ AuthenticationInterface::class);
Loading history...
22
        $clientMock = \Mockery::mock(ClientInterface::class);
23
        $clientMock->shouldReceive('sendRequest')
1 ignored issue
show
Bug introduced by
'sendRequest' of type string is incompatible with the type array expected by parameter $methodNames of Mockery\MockInterface::shouldReceive(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        $clientMock->shouldReceive(/** @scrutinizer ignore-type */ 'sendRequest')
Loading history...
24
            ->with(
25
                Api::REQUEST_POST,
1 ignored issue
show
Bug introduced by
TogglJira\Jira\Api::REQUEST_POST of type string is incompatible with the type array<mixed,mixed> expected by parameter $args of Mockery\Expectation::with(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
                /** @scrutinizer ignore-type */ Api::REQUEST_POST,
Loading history...
26
                "/rest/api/2/issue/DVA-42/worklog?adjustEstimate=auto",
27
                [
28
                    'author' => [
29
                        'accountId' => 'D-Va',
30
                    ],
31
                    'created' => '2017-04-15T23:35:00+02:00',
32
                    'timeSpentSeconds' => 9001,
33
                    'comment' => 'Nerf this!'
34
                ],
35
                'http://www.example.com',
36
                $authenticationMock,
1 ignored issue
show
Bug introduced by
$authenticationMock of type Mockery\MockInterface is incompatible with the type array<mixed,mixed> expected by parameter $args of Mockery\Expectation::with(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
                /** @scrutinizer ignore-type */ $authenticationMock,
Loading history...
37
                false,
1 ignored issue
show
Bug introduced by
false of type false is incompatible with the type array<mixed,mixed> expected by parameter $args of Mockery\Expectation::with(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
                /** @scrutinizer ignore-type */ false,
Loading history...
38
                false
39
            )
40
        ->andReturn('{}');
2 ignored issues
show
Bug introduced by
'{}' of type string is incompatible with the type array<mixed,mixed> expected by parameter $args of Mockery\Expectation::andReturn(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        ->andReturn(/** @scrutinizer ignore-type */ '{}');
Loading history...
Bug introduced by
'{}' of type string is incompatible with the type array expected by parameter $args of Mockery\ExpectationInterface::andReturn(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        ->andReturn(/** @scrutinizer ignore-type */ '{}');
Loading history...
41
42
        $api = new Api($endPoint, $authenticationMock, $clientMock);
2 ignored issues
show
Bug introduced by
$authenticationMock of type Mockery\MockInterface is incompatible with the type chobie\Jira\Api\Authenti...AuthenticationInterface expected by parameter $authentication of TogglJira\Jira\Api::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
        $api = new Api($endPoint, /** @scrutinizer ignore-type */ $authenticationMock, $clientMock);
Loading history...
Bug introduced by
$clientMock of type Mockery\MockInterface is incompatible with the type chobie\Jira\Api\Client\ClientInterface|null expected by parameter $client of TogglJira\Jira\Api::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
        $api = new Api($endPoint, $authenticationMock, /** @scrutinizer ignore-type */ $clientMock);
Loading history...
43
44
        $result = $api->addWorkLogEntry(
45
            'DVA-42',
46
            9001,
47
            'D-Va',
48
            'Nerf this!',
49
            '2017-04-15T23:35:00+02:00'
50
        );
51
52
        $this->assertInstanceOf(Result::class, $result);
53
    }
54
}