Completed
Push — master ( ed48d3...e52a1e )
by Daniel
02:16
created

JobTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
namespace Jobles\Tests\Core\Job;
4
5
use Jobles\Core\Index\Index;
6
use Jobles\Core\Job\Job;
7
8
class JobTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @var Job
12
     */
13
    private $job;
14
15
    public function setUp()
16
    {
17
        $this->job = new Job;
18
        $this->job->setKey('job_key');
19
        $this->job->setIndex(new Index('index_key', 'Index Name', 'http://index.url', 'affId'));
20
        $this->job->setTitle('Analista de Sistema para Software de RH');
21
        $this->job->setCompany('Mega Enterprise, Co');
22
        $this->job->setSalaryCurrencyCode('BRL');
23
        $this->job->setSalaryMin(1000);
24
        $this->job->setSalaryMax(2000);
25
        $this->job->setCity('Sao Paulo');
26
        $this->job->setState('SP');
27
        $this->job->setCountry('Brasil');
28
        $this->job->setSource('www.ceviu.com.br');
29
        $this->job->setDate(new \DateTime('Sat, 13 Feb 2016 08:59:39 GMT'));
30
        $this->job->setSnippet('Principais atribuições do cargo...');
31
        $this->job->setDescription('Descrição detalhada do cargo...');
32
        $this->job->setViewUrl('http://job.url/pt-br/job-12345');
33
        $this->job->setApplyUrl('http://job.url/pt-br/apply-12345');
34
        $this->job->setFeatured(false);
35
    }
36
37
    public function testGetKey()
38
    {
39
        $this->assertEquals('job_key', $this->job->getKey());
40
    }
41
42
    public function testGetIndex()
43
    {
44
        $this->assertInstanceOf(Index::class, $this->job->getIndex());
45
        $this->assertEquals('index_key', $this->job->getIndex()->getKey());
46
        $this->assertEquals('Index Name', $this->job->getIndex()->getName());
47
        $this->assertEquals('http://index.url', $this->job->getIndex()->getUrl());
48
        $this->assertEquals('affId', $this->job->getIndex()->getAffiliateId());
49
    }
50
51
    public function testGetTitle()
52
    {
53
        $this->assertEquals('Analista de Sistema para Software de RH', $this->job->getTitle());
54
    }
55
56
    public function testGetCompany()
57
    {
58
        $this->assertEquals('Mega Enterprise, Co', $this->job->getCompany());
59
    }
60
61
    public function testGetSalaryCurrencyCode()
62
    {
63
        $this->assertEquals('BRL', $this->job->getSalaryCurrencyCode());
64
    }
65
66
    public function testGetSalaryMin()
67
    {
68
        $this->assertEquals(1000, $this->job->getSalaryMin());
69
    }
70
71
    public function testGetSalaryMax()
72
    {
73
        $this->assertEquals(2000, $this->job->getSalaryMax());
74
    }
75
76
    public function testGetCity()
77
    {
78
        $this->assertEquals('Sao Paulo', $this->job->getCity());
79
    }
80
81
    public function testGetState()
82
    {
83
        $this->assertEquals('SP', $this->job->getState());
84
    }
85
86
    public function testGetCountry()
87
    {
88
        $this->assertEquals('Brasil', $this->job->getCountry());
89
    }
90
91
    public function testGetSource()
92
    {
93
        $this->assertEquals('www.ceviu.com.br', $this->job->getSource());
94
    }
95
96
    public function testGetDate()
97
    {
98
        $this->assertEquals('2016-02-13 08:59:39', $this->job->getDate()->format('Y-m-d H:i:s'));
99
    }
100
101
    public function testGetSnippet()
102
    {
103
        $this->assertEquals('Principais atribuições do cargo...', $this->job->getSnippet());
104
    }
105
106
    public function testGetDescription()
107
    {
108
        $this->assertEquals('Descrição detalhada do cargo...', $this->job->getDescription());
109
    }
110
111
    public function testGetViewUrl()
112
    {
113
        $this->assertEquals('http://job.url/pt-br/job-12345', $this->job->getViewUrl());
114
    }
115
116
    public function testGetApplyUrl()
117
    {
118
        $this->assertEquals('http://job.url/pt-br/apply-12345', $this->job->getApplyUrl());
119
    }
120
121
    public function testisFeatured()
122
    {
123
        $this->assertFalse($this->job->isFeatured());
124
    }
125
}
126