SectionApiFactoryTest::testCreateEveSection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace Tarioch\EveapiFetcherBundle\Tests\Unit\Component\Section;
3
4
use Mockery as m;
5
use Tarioch\EveapiFetcherBundle\Entity\Api;
6
use Tarioch\EveapiFetcherBundle\Component\Section\SectionApiFactory;
7
use Tarioch\EveapiFetcherBundle\Component\Section\NoKeySectionApi;
8
use Tarioch\EveapiFetcherBundle\Component\Section\KeySectionApi;
9
10
class SectionApiFactoryTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @var NoKeySectionApi
14
     */
15
    private $noKeySectionApi;
16
    /**
17
     * @var KeySectionApi
18
     */
19
    private $keySectionApi;
20
    /**
21
     * @var ApiCall
22
     */
23
    private $apiCall;
24
    /**
25
     * @var Api
26
     */
27
    private $api;
28
29
    /**
30
     * @var SectionApiFactory
31
     */
32
    private $factory;
33
34
    public function testCreateAccountSection()
35
    {
36
        $this->api->shouldReceive('getSection')->andReturn('account');
37
38
        $this->assertSame($this->keySectionApi, $this->factory->create($this->apiCall));
39
    }
40
41
    public function testCreateCharSection()
42
    {
43
        $this->api->shouldReceive('getSection')->andReturn('char');
44
45
        $this->assertSame($this->keySectionApi, $this->factory->create($this->apiCall));
46
    }
47
48
    public function testCreateCorpSection()
49
    {
50
        $this->api->shouldReceive('getSection')->andReturn('corp');
51
52
        $this->assertSame($this->keySectionApi, $this->factory->create($this->apiCall));
53
    }
54
55
    public function testCreateServerSection()
56
    {
57
        $this->api->shouldReceive('getSection')->andReturn('server');
58
59
        $this->assertSame($this->noKeySectionApi, $this->factory->create($this->apiCall));
60
    }
61
62
    public function testCreateEveSection()
63
    {
64
        $this->api->shouldReceive('getSection')->andReturn('eve');
65
66
        $this->assertSame($this->noKeySectionApi, $this->factory->create($this->apiCall));
67
    }
68
69
    public function testCreateMapSection()
70
    {
71
        $this->api->shouldReceive('getSection')->andReturn('map');
72
73
        $this->assertSame($this->noKeySectionApi, $this->factory->create($this->apiCall));
74
    }
75
76
    public function setUp()
77
    {
78
        $this->noKeySectionApi = m::mock('Tarioch\EveapiFetcherBundle\Component\Section\NoKeySectionApi');
79
        $this->keySectionApi = m::mock('Tarioch\EveapiFetcherBundle\Component\Section\KeySectionApi');
80
        $this->apiCall = m::mock('Tarioch\EveapiFetcherBundle\Entity\ApiCall');
81
        $this->api = m::mock('Tarioch\EveapiFetcherBundle\Entity\Api');
82
83
        $this->factory = new SectionApiFactory(
84
            $this->keySectionApi,
85
            $this->noKeySectionApi
86
        );
87
88
        $this->apiCall->shouldReceive('getApi')->andReturn($this->api);
89
    }
90
}
91