SyncServiceFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 1
eloc 21
c 2
b 1
f 0
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testInvoke() 0 27 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TogglJiraTest\Service;
5
6
use Psr\Log\LoggerInterface;
7
use TogglJira\Options\SyncOptions;
8
use TogglJira\Service\SyncService;
9
use TogglJira\Service\SyncServiceFactory;
10
use TogglJiraTest\BaseContainerTest;
11
12
class SyncServiceFactoryTest extends BaseContainerTest
13
{
14
    /**
15
     * @return void
16
     * @throws \Interop\Container\Exception\ContainerException
17
     */
18
    public function testInvoke(): void
19
    {
20
        $syncOptionMock = \Mockery::mock(SyncOptions::class);
21
        $syncOptionMock->shouldReceive('getJiraUrl')->andReturn('http://www.example.com');
22
        $syncOptionMock->shouldReceive('getJiraUsername')->andReturn('foo');
23
        $syncOptionMock->shouldReceive('getJiraLoginUsername')->andReturn('[email protected]');
24
        $syncOptionMock->shouldReceive('getJiraPassword')->andReturn('bar');
25
        $syncOptionMock->shouldReceive('getTogglApiKey')->andReturn('baz');
26
        $syncOptionMock->shouldReceive('getFillIssueID')->andReturn('FOO-01');
27
        $syncOptionMock->shouldReceive('isNotifyUsers')->andReturn(true);
28
29
        $loggerMock = \Mockery::mock(LoggerInterface::class);
30
31
        $this->getContainer()
32
            ->shouldReceive('get')
33
            ->withArgs([SyncOptions::class])
34
            ->andReturn($syncOptionMock);
35
36
        $this->getContainer()
37
            ->shouldReceive('get')
38
            ->withArgs(['Logger'])
39
            ->andReturn($loggerMock);
40
41
        $factory = new SyncServiceFactory();
42
        $instance = $factory->__invoke($this->getContainer(), SyncService::class);
43
44
        $this->assertInstanceOf(SyncService::class, $instance);
45
    }
46
}
47