/** * {@inheritdoc} */ public function createJobExecution(JobInstance $jobInstance) { if (null !== $jobInstance->getId()) { $jobInstance = $this->jobManager->merge($jobInstance); } else { $this->jobManager->persist($jobInstance); } $jobExecution = new $this->jobExecutionClass(); $jobExecution->setJobInstance($jobInstance); $this->updateJobExecution($jobExecution); return $jobExecution; }
/** * @param JobInstance $job * * @When /^I launch the ("([^"]*)" (import|export) job)$/ */ public function iLaunchTheExportJob(JobInstance $job) { $jobType = ucfirst($job->getType()); $this->getNavigationContext()->openPage(sprintf('%s launch', $jobType), ['id' => $job->getId()]); }
/** * @param JobInstance $job * * @Given /^I should be on the ("([^"]*)" (import|export) job) page$/ */ public function iShouldBeOnTheJobPage(JobInstance $job) { $jobPage = sprintf('%s show', ucfirst($job->getType())); $expectedAddress = $this->getPage($jobPage)->getUrl(['id' => $job->getId()]); $this->assertAddress($expectedAddress); }
/** * @param string $action * @param JobInstance $job * * @return \Behat\Behat\Context\Step\Then * * @When /^I should not be able to (launch|edit) the ("([^"]*)" (export|import) job)$/ */ public function iShouldNotBeAbleToAccessTheJob($action, JobInstance $job) { $this->currentPage = sprintf("%s %s", ucfirst($job->getType()), $action); $page = $this->getCurrentPage()->open(['id' => $job->getId()]); return new Step\Then('I should see "403 Forbidden"'); }
/** * @param JobInstance $job * * @Given /^I am on the ("([^"]*)" import job) edit page$/ */ public function iAmOnTheImportJobEditPage(JobInstance $job) { $this->getNavigationContext()->openPage('Import edit', ['id' => $job->getId()]); }
/** * {@inheritdoc} */ public function getLastJobExecution(JobInstance $jobInstance, $status) { return $this->jobManager->createQueryBuilder()->select('j')->from($this->jobExecutionClass, 'j')->where('j.jobInstance = :job_instance')->andWhere('j.status = :status')->setParameter('job_instance', $jobInstance->getId())->setParameter('status', $status)->orderBy('j.startTime', 'DESC')->setMaxResults(1)->getQuery()->getOneOrNullResult(); }