protected function initJob() { $repo = $this->repository; $organization = $this->organization; for ($i = 1; $i <= 5; $i++) { $title = 'Job Repository Test ' . $i; $job = $repo->findOneBy(array('title' => $title)); if (!$job) { $job = new Job(); $job->setTitle($title); $job->setStatus(Status::ACTIVE); $job->setIsDraft(false); $job->setOrganization($organization); $this->dm->persist($job); $this->dm->flush($job); } $this->jobs[] = $job; } $title = 'Job Repository Test Draft'; $job = $repo->findOneBy(array('title' => $title)); if (!$job instanceof Job) { $job = new Job(); $job->setTitle($title); $job->setIsDraft(true); $job->setStatus(Status::CREATED); $job->setOrganization($organization); $this->dm->persist($job); $this->dm->flush($job); } }
/** * @testdox Allows setting the status of a job posting * @covers Jobs\Entity\Job::getTemplate * @covers Jobs\Entity\Job::setTemplate * @dataProvider provideIsActiveTestData */ public function testIsActive($isDraft, $status, $expected) { $this->target->setIsDraft($isDraft); $this->target->setStatus($status); $this->assertEquals($expected, $this->target->isActive()); }