| 1 | <?php |
||
| 23 | class ApplicationContext implements Context |
||
| 24 | { |
||
| 25 | use CommonContextTrait; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @Given I apply for :title job |
||
| 29 | * |
||
| 30 | * @param string $title |
||
| 31 | * @throws \Exception when the titled job not exists |
||
| 32 | */ |
||
| 33 | public function iApplyAJob($title) |
||
| 34 | { |
||
| 35 | /* @var $repo JobRepository */ |
||
| 36 | $repo = $this->getRepository('Jobs/Job'); |
||
| 37 | $job = $repo->findOneBy(['title' => $title]); |
||
| 38 | if(!$job instanceof Job){ |
||
| 39 | throw new \Exception('There is no job titled: "'.$title.'"'); |
||
| 40 | } |
||
| 41 | $job->setApplyId($job->getId()); |
||
| 42 | $repo->store($job); |
||
| 43 | |||
| 44 | $url = $this->buildUrl('lang/apply',[ |
||
| 45 | 'applyId' => $job->getApplyId() |
||
| 46 | ]); |
||
| 47 | $this->visit($url); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @Given I visit job categories |
||
| 52 | */ |
||
| 53 | public function visitJobsCategories() |
||
| 54 | { |
||
| 55 | $url = '/admin/jobs/categories'; |
||
| 56 | $this->visit($url); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |