/**
  * Test finding vacancies from all sources. Sources are added and removed dynamically.
  * One vacancy can be taken only once.
  */
 public function testFindAll()
 {
     $repository = new VacancyRepository();
     $repository->addSource($this->source1);
     $repository->addSource($this->source2);
     $this->assertEquals(array(1 => $this->vacancy1, 2 => $this->vacancy2), $repository->findAll());
     $repository->removeSource($this->source2);
     $this->assertEquals(array(1 => $this->vacancy1), $repository->findAll());
     $repository->removeSource($this->source1);
     $this->assertEquals(array(), $repository->findAll());
 }
示例#2
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
use Netwerven\VacancyRepository;
use Netwerven\Sources\DummySource;
$repository = new VacancyRepository(array(new DummySource()));
$id = 125;
$vacancy = $repository->find($id);
var_dump($vacancy);
$vacancies = $repository->findAll();
var_dump($vacancies);