FacilityTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 1
cbo 6
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testUpdate() 0 19 1
A setUp() 0 6 1
1
<?php
2
namespace Tarioch\EveapiFetcherBundle\Tests\Functional\Api\Corp;
3
4
use Tarioch\EveapiFetcherBundle\Tests\Functional\AbstractFunctionalTestCase;
5
use Tarioch\EveapiFetcherBundle\Entity\ApiCall;
6
use Tarioch\EveapiFetcherBundle\Entity\ApiKey;
7
use Tarioch\EveapiFetcherBundle\Entity\AccountCharacter;
8
use Tarioch\EveapiFetcherBundle\Component\EveApi\Corp\FacilityUpdater;
9
use Pheal\Pheal;
10
11
class FacilityTest extends AbstractFunctionalTestCase
12
{
13
    private $api;
14
    private $pheal;
15
16
    public function testUpdate()
17
    {
18
        $key = new ApiKey(123, 'dummyvcode');
19
        $owner = new AccountCharacter($key, 123);
20
        $owner->setCorporationId(11);
21
        $call = new ApiCall('dummyapi', $owner, $key);
22
        $this->api->update($call, $key, $this->pheal);
23
        $this->entityManager->flush();
24
        $repo = $this->entityManager->getRepository('TariochEveapiFetcherBundle:CorpFacility');
25
        $facility = $repo->findOneByFacilityId(1);
26
        $this->assertEquals(2, $facility->getTypeId());
27
        $this->assertEquals('TypeName', $facility->getTypeName());
28
        $this->assertEquals(3, $facility->getSolarSystemId());
29
        $this->assertEquals('SolarSystemName', $facility->getSolarSystemName());
30
        $this->assertEquals(4, $facility->getRegionId());
31
        $this->assertEquals('RegionName', $facility->getRegionName());
32
        $this->assertEquals(5, $facility->getStarbaseModifier());
33
        $this->assertEquals(6, $facility->getTax());
34
    }
35
    
36
    public function setUp()
37
    {
38
        parent::setUp();
39
        $this->api = new FacilityUpdater($this->entityManager);
40
        $this->pheal = new Pheal(123, 'dummyvcode');
41
    }
42
}
43