/**
  * test updateStatusByContentType
  */
 public function testUpdateStatusByContentType()
 {
     $contentTypeId = 'test';
     $outOfWorkflow = $this->statusRepository->findOneByOutOfWorkflow();
     $dm = $this->contentTypeRepository->getDocumentManager();
     $contentType = new ContentType();
     $contentType->setContentTypeId($contentTypeId);
     $dm->persist($contentType);
     $dm->flush();
     $content = new Content();
     $content->setContentType($contentTypeId);
     $dm->persist($content);
     $dm->flush();
     $this->assertEquals('draft', $content->getStatus()->getName());
     $this->repository->updateStatusByContentType($outOfWorkflow, $contentTypeId);
     $dm->clear();
     $updatedContent = $this->repository->findOneBy(array('_id' => $content->getId()));
     $this->assertEquals('outOfWorkflow', $updatedContent->getStatus()->getName());
     $contentType = $this->contentTypeRepository->findOneBy(array('contentTypeId' => $contentTypeId));
     $dm->remove($updatedContent);
     $dm->remove($contentType);
     $dm->flush();
 }
 /**
  * @return ContentType
  */
 protected function generateContentTypeCustomer()
 {
     $maxLengthOption = $this->generateOption('max_length', 25);
     $required = $this->generateOption('required', true);
     $customerFirstName = new FieldType();
     $customerFirstName->setFieldId('firstname');
     $customerFirstName->addLabel('en', 'Firstname');
     $customerFirstName->addLabel('fr', 'Prénom');
     $customerFirstName->setDefaultValue('');
     $customerFirstName->setSearchable(true);
     $customerFirstName->setType('text');
     $customerFirstName->addOption($maxLengthOption);
     $customerFirstName->addOption($required);
     $customerFirstName->setFieldTypeSearchable('text');
     $customerLastName = new FieldType();
     $customerLastName->setFieldId('lastname');
     $customerLastName->addLabel('en', 'Lastname');
     $customerLastName->addLabel('fr', 'Nom de famille');
     $customerLastName->setDefaultValue('');
     $customerLastName->setSearchable(true);
     $customerLastName->setType('text');
     $customerLastName->addOption($maxLengthOption);
     $customerLastName->addOption($required);
     $customerLastName->setFieldTypeSearchable('text');
     $customerIdentifier = new FieldType();
     $customerIdentifier->setFieldId('identifier');
     $customerIdentifier->addLabel('en', 'Identifier');
     $customerIdentifier->addLabel('fr', 'Identifiant');
     $customerIdentifier->setDefaultValue(0);
     $customerIdentifier->setSearchable(false);
     $customerIdentifier->setType('integer');
     $customerIdentifier->addOption($maxLengthOption);
     $customerIdentifier->addOption($required);
     $customerIdentifier->setFieldTypeSearchable('number');
     $customer = new ContentType();
     $customer->setContentTypeId('customer');
     $customer->addName('en', 'Customer');
     $customer->addName('fr', 'Client');
     $customer->setDefiningStatusable(true);
     $customer->setDefiningVersionable(true);
     $customer->setDeleted(false);
     $customer->setVersion(1);
     $customer->setDefaultListable($this->genereteDefaultListable());
     $customer->addFieldType($customerFirstName);
     $customer->addFieldType($customerLastName);
     $customer->addFieldType($customerIdentifier);
     return $customer;
 }