Esempio n. 1
0
 public function testFromApi()
 {
     $apiJob = new \stdClass();
     $apiJob->title = 'Analista de Sistema para Software de RH';
     $apiJob->date = 'Sat, 13 Feb 2016 08:59:39 GMT';
     $apiJob->description = 'Principais atribuições do cargo...';
     $apiJob->url = 'http://jobviewtrack.com/pt-br/job-12345';
     $apiJob->site = 'www.ceviu.com.br';
     $apiJob->company = 'Mega Enterprise, Co';
     $apiJob->locations = 'São Paulo - SP';
     $apiJob->salary_currency_code = 'BRL';
     $apiJob->salary_min = '1000';
     $apiJob->salary_max = '2000';
     $job = JobBuilder::fromApi($apiJob, 'Brazil');
     $this->assertEquals('Analista de Sistema para Software de RH', $job->getTitle());
     $this->assertInstanceOf(\DateTime::class, $job->getDate());
     $this->assertEquals('2016-02-13 08:59:39', $job->getDate()->format('Y-m-d H:i:s'));
     $this->assertEquals('Principais atribuições do cargo...', $job->getSnippet());
     $this->assertEquals('http://jobviewtrack.com/pt-br/job-12345', $job->getViewUrl());
     $this->assertEquals('www.ceviu.com.br', $job->getSource());
     $this->assertEquals('Mega Enterprise, Co', $job->getCompany());
     $this->assertEquals('São Paulo', $job->getCity());
     $this->assertEquals('SP', $job->getState());
     $this->assertEquals('BRL', $job->getSalaryCurrencyCode());
     $this->assertEquals('1000', $job->getSalaryMin());
     $this->assertEquals('2000', $job->getSalaryMax());
     $job = JobBuilder::fromApi($apiJob, 'China');
     $this->assertEmpty($job->getState());
     $this->assertEmpty($job->getCity());
 }
Esempio n. 2
0
 /**
  * @param array $filters
  *
  * @return JobCollection
  * @throws Exception\CareerjetException
  */
 public function search(array $filters = []) : JobCollection
 {
     $collection = new JobCollection();
     $search = ['affid' => $this->affiliateId];
     if (isset($filters['keywords'])) {
         // empty allowed
         $search['keywords'] = $filters['keywords'];
     }
     if (isset($filters['location'])) {
         // empty allowed
         $search['location'] = $filters['location'];
     }
     if (isset($filters['limit'])) {
         // max 99
         $search['pagesize'] = $filters['limit'];
     }
     $search['page'] = isset($filters['offset']) ? $filters['offset'] : 1;
     // starts on 1
     $result = $this->api->search($search);
     foreach ($result->jobs as $job) {
         $collection->add(JobBuilder::fromApi($job, $this->country));
     }
     return $collection;
 }