/**
  * Test content type versionnning
  */
 public function testFormController()
 {
     $contentTypes = $this->contentTypeRepository->findAll();
     $contentTypeCount = count($contentTypes);
     $crawler = $this->client->request('GET', '/admin/content-type/form/news');
     $form = $crawler->selectButton('Save')->form();
     $this->submitForm($form);
     $contentTypes = $this->contentTypeRepository->findAll();
     $this->assertCount($contentTypeCount + 1, $contentTypes);
 }
 /**
  * @param string $contentTypeId
  *
  * @return array
  */
 public function getMapping($contentTypeId)
 {
     $mapping = array();
     /**
      * @var ContentTypeInterface
      */
     $contentType = $this->contentTypeRepository->findOneByContentTypeIdInLastVersion($contentTypeId);
     if (null !== $contentType) {
         /**
          * @var $field FieldTypeInterface
          */
         foreach ($contentType->getFields() as $field) {
             $fieldId = $field->getFieldId();
             $key = 'attributes.' . $fieldId . '.string_value';
             $mapping[$key] = array('field' => 'attributes.' . $fieldId . '.stringValue', 'key' => $key, 'type' => 'string');
         }
     }
     return $mapping;
 }
 /**
  * @param ContentTypeRepositoryInterface       $contentTypeRepository
  * @param ContextManager                       $contextManager
  * @param string                               $parent
  * @param int                                  $weight
  * @param array                                $dataParameter
  * @param TranslatorInterface                  $translator
  * @param MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager
  */
 public function __construct(ContentTypeRepositoryInterface $contentTypeRepository, ContextManager $contextManager, $parent, $weight, array $dataParameter, TranslatorInterface $translator, MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManager)
 {
     $this->contentTypes = $contentTypeRepository->findAllNotDeletedInLastVersion($contextManager->getCurrentLocale());
     $this->multiLanguagesChoiceManager = $multiLanguagesChoiceManager;
     parent::__construct('content_type_for_content', $weight, $parent, self::ROLE_ACCESS_CONTENT_TYPE_FOR_CONTENT, $dataParameter, $translator);
 }
 /**
  * @param string $contentType
  * @param int    $version
  *
  * @dataProvider provideContentTypeAndVersionNumber
  */
 public function testFindOneByContentTypeIdInLastVersion($contentType, $version)
 {
     $contentTypeElement = $this->repository->findOneByContentTypeIdInLastVersion($contentType);
     $this->assertEquals($version, $contentTypeElement->getVersion());
 }