Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 public function provideInjectOrganizationTestData()
 {
     $org = new Organization();
     $org->setId('alreadyHereOrg');
     $job = new Job();
     $job->setOrganization($org);
     return array(array(new \stdClass(), 'default'), array($job, 'default'), array(new Job(), 'one'), array(new Job(), 'more'));
 }
Beispiel #3
0
 public function testSetGetCompanyWithOrganization()
 {
     $input1 = "Company ABC";
     $input2 = "Another Company";
     $this->target->setCompany($input1);
     $organization = new Organization();
     $organizationName = new OrganizationName();
     $organizationName->setName($input2);
     $organization->setOrganizationName($organizationName);
     $this->target->setOrganization($organization);
     $this->assertEquals($this->target->getCompany(), $input2);
 }
 /**
  * @param array $params
  *
  * @return Job
  */
 public static function createEntityWithRandomData(array $params = array())
 {
     $params = static::createNewRelations($params);
     $withId = true;
     $entityId = bin2hex(substr(uniqid(), 1));
     // define here another variables
     extract($params);
     $entity = new Job();
     // here set another variables
     if (isset($organization)) {
         $entity->setOrganization($organization);
     }
     if ($withId) {
         $entity->setId($entityId);
     }
     return $entity;
 }