Exemplo n.º 1
0
 public function setUp()
 {
     $jobCollection = new JobCollection();
     $job = new Job();
     $job->setTitle('Job 1');
     $jobCollection->add($job);
     $job = new Job();
     $job->setTitle('Job 2');
     $jobCollection->add($job);
     $this->iterator = new Iterator($jobCollection);
 }
Exemplo 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;
 }
Exemplo n.º 3
0
 public function testAddShouldThrowInvalidArgumentExceptionWhenAddingInvalidObjectToArrayData()
 {
     $this->expectException(\InvalidArgumentException::class);
     $this->expectExceptionMessage('Object is not an instance of ' . Job::class);
     $this->collection->add(new \stdClass());
 }