Passed
Push — master ( b67974...1b1f16 )
by Daniel
03:18
created

testLocationIsBrasil()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 13
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
namespace Jobles\Tests\Careerjet\Builder;
4
5
use Jobles\Careerjet\Builder\JobWithBrazilianLocationsBuilder;
6
use Jobles\Core\Job\Job;
7
8
class JobWithBrazilianLocationsBuilderTest extends \PHPUnit_Framework_TestCase
9
{
10
    public function testFromApiThrowsCareerjetExceptionWhenLocationIsNotPresent()
11
    {
12
        $this->expectException(\Jobles\Careerjet\Exception\CareerjetException::class);
13
        $this->expectExceptionMessage('Invalid API job');
14
15
        JobWithBrazilianLocationsBuilder::fromApi(new \stdClass, new Job);
16
    }
17
18
    public function testLocationIsBrasil()
19
    {
20
        $apiJob = new \stdClass;
21
        $apiJob->locations = 'Brasil';
22
23
        $job = new Job;
24
        $job->setCountry('Brazil');
25
        $job = JobWithBrazilianLocationsBuilder::fromApi($apiJob, $job);
26
27
        $this->assertNull($job->getState());
28
        $this->assertNull($job->getCity());
29
        $this->assertEquals('Brazil', $job->getCountry());
30
    }
31
}
32