/**
  * @return Content
  */
 protected function generateCustomerContentFr()
 {
     $content = new Content();
     $content->setContentId("jsmith");
     $content->setContentType("customer");
     $content->setContentTypeVersion(1);
     $content->setDeleted(false);
     $content->setCreatedBy('admin');
     $content->setStatus($this->getReference('status-published'));
     $content->setName("John Smith");
     $content->setLanguage("fr");
     $content->setVersion(1);
     $content->setLinkedToSite(true);
     $content->setSiteId('3');
     $attribute1 = $this->generateContentAttribute('firstname', 'John');
     $attribute2 = $this->generateContentAttribute('lastname', 'Smith');
     $attribute3 = $this->generateContentAttribute('identifier', 4987, 'integer');
     $content->addAttribute($attribute1);
     $content->addAttribute($attribute2);
     $content->addAttribute($attribute3);
     return $content;
 }
 /**
  * Test post set data form content
  *
  * @param mixed $attributeValue
  * @param mixed $fieldValue
  * @param int   $countError
  *
  * @dataProvider provideFormAttributeValue
  */
 public function testFormFieldTransformation($attributeValue, $fieldValue, $countError)
 {
     $content = new Content();
     $content->setContentType("customer");
     $attribute = new ContentAttribute();
     $attribute->setName("identifier");
     $attribute->setValue($attributeValue);
     $attribute->setType('integer');
     $content->addAttribute($attribute);
     $form = $this->formFactory->create('oo_content', $content, array('csrf_protection' => false));
     $this->assertSame($countError, count($form->get('identifier')->getErrors()));
     $this->assertSame($fieldValue, $form->get('identifier')->getData());
 }
 /**
  * Fill news attributes
  *
  * @param Content          $news
  * @param ContentAttribute $title
  * @param ContentAttribute $intro
  * @param ContentAttribute $text
  *
  * @return Content
  */
 protected function addNewsAttributes($news, $title, $intro, $text)
 {
     $news->addAttribute($title);
     $news->addAttribute($this->generateContentAttribute('publish_start', '2014-08-26', 'date'));
     $news->addAttribute($this->generateContentAttribute('publish_end', '2014-12-19', 'date'));
     $news->addAttribute($intro);
     $news->addAttribute($text);
     return $news;
 }
 /**
  * Fill news attributes
  *
  * @param Content          $news
  * @param ContentAttribute $title
  * @param ContentAttribute $start
  * @param ContentAttribute $end
  * @param ContentAttribute $intro
  * @param ContentAttribute $text
  *
  * @return Content
  */
 protected function addNewsAttributes($news, $title, $start, $end, $intro, $text)
 {
     $news->addAttribute($title);
     $news->addAttribute($start);
     $news->addAttribute($end);
     $news->addAttribute($intro);
     $news->addAttribute($text);
     return $news;
 }