Conditions | 1 |
Paths | 1 |
Total Lines | 26 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function testSearch() |
||
12 | { |
||
13 | $filtersOutside = [ |
||
14 | 'keywords' => 'PHP', |
||
15 | 'location' => 'Sao Paulo', |
||
16 | 'limit' => '5', |
||
17 | ]; |
||
18 | $filtersInside = [ |
||
19 | 'keywords' => 'PHP', |
||
20 | 'location' => 'Sao Paulo', |
||
21 | 'pagesize' => '5', |
||
22 | 'page' => 1, |
||
23 | 'affid' => '12345', |
||
24 | ]; |
||
25 | $json = '{"jobs":[{"locations":"São Paulo - SP","site":"www.ceviu.com.br","date":"Sat, 13 Feb 2016 08:57:17 GMT","url":"http://jobviewtrack.com/pt-br/job-12345","title":"Programador PHP PL","description":"Atividades: Responsável pela implementação dos projetos web","company":"","salary":""}],"hits":748,"response_time":0.0886948108673096,"type":"JOBS","pages":748}'; |
||
26 | $mock = $this->getMockBuilder('Careerjet_API')->disableOriginalConstructor()->getMock(); |
||
27 | $mock->method('search')->with($filtersInside)->willReturn(json_decode($json)); |
||
28 | $api = new Api('12345', 'Brazil', null, $mock); |
||
29 | $result = $api->search($filtersOutside); |
||
30 | |||
31 | $this->assertInstanceOf(JobCollection::class, $result); |
||
32 | $this->assertCount(1, $result); |
||
33 | $job = $result->pick(0); |
||
34 | $this->assertInstanceOf(Job::class, $job); |
||
35 | $this->assertEquals('Programador PHP PL', $job->getTitle()); |
||
36 | } |
||
37 | } |
||
38 |