/** * Generate a content attribute * * @param string $name * @param string $value * @param string $type * * @return ContentAttribute */ protected function generateContentAttribute($name, $value, $type = 'text') { $attribute = new ContentAttribute(); $attribute->setName($name); $attribute->setValue($value); $attribute->setStringValue($value); $attribute->setType($type); return $attribute; }
/** * 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()); }