AbstractIndustryJobTest::testUpdate()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
dl 0
loc 38
rs 8.8571
c 2
b 1
f 1
cc 1
eloc 36
nc 1
nop 0
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\IndustryJobUpdater;
9
use Pheal\Pheal;
10
11
abstract class AbstractIndustryJobTest extends AbstractFunctionalTestCase
12
{
13
    protected $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:CorpIndustryJob');
25
        $job = $repo->findOneByJobId(11);
26
        $this->assertEquals(11, $job->getOwnerId());
27
        $this->assertEquals(22, $job->getInstallerId());
28
        $this->assertEquals('InstallerName', $job->getInstallerName());
29
        $this->assertEquals(33, $job->getFacilityId());
30
        $this->assertEquals(44, $job->getSolarSystemId());
31
        $this->assertEquals('SolarSystemName', $job->getSolarSystemName());
32
        $this->assertEquals(55, $job->getStationId());
33
        $this->assertEquals(66, $job->getActivityId());
34
        $this->assertEquals(77, $job->getBlueprintId());
35
        $this->assertEquals('BlueprintTypeName', $job->getBlueprintTypeName());
36
        $this->assertEquals(99, $job->getBlueprintLocationId());
37
        $this->assertEquals(2, $job->getOutputLocationId());
38
        $this->assertEquals(3, $job->getRuns());
39
        $this->assertEquals(4.1, $job->getCost());
40
        $this->assertEquals(0, $job->getTeamId());
41
        $this->assertEquals(5, $job->getLicensedRuns());
42
        $this->assertEquals(0.2, $job->getProbability());
43
        $this->assertEquals(6, $job->getProductTypeId());
44
        $this->assertEquals('ProductTypeName', $job->getProductTypeName());
45
        $this->assertEquals(1, $job->getStatus());
46
        $this->assertEquals(816000, $job->getTimeInSeconds());
47
        $this->assertEquals(new \DateTime('2015-04-01 12:32:59'), $job->getStartDate());
48
        $this->assertEquals(new \DateTime('2015-05-02 23:12:59'), $job->getEndDate());
49
        $this->assertEquals(new \DateTime('0001-01-01 00:00:00'), $job->getPauseDate());
50
        $this->assertEquals(new \DateTime('0001-01-01 00:00:00'), $job->getCompletedDate());
51
        $this->assertEquals(0, $job->getCompletedCharacterId());
52
        $this->assertEquals(0, $job->getSuccessfulRuns());
53
    }
54
    
55
    public function setUp()
56
    {
57
        parent::setUp();
58
        $this->pheal = new Pheal(123, 'dummyvcode');
59
    }
60
}
61