add testing for customfield, correcting request injection

This commit is contained in:
2014-11-08 15:07:15 +01:00
parent 8b71a9e7cf
commit 7daa1a240e
14 changed files with 225 additions and 1762 deletions

View File

@@ -7,6 +7,7 @@ namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
/**
*
@@ -16,6 +17,13 @@ use Symfony\Component\Form\FormBuilderInterface;
class CustomFieldText implements CustomFieldInterface
{
private $requestStack;
public function __construct(RequestStack $requestStack)
{
$this->requestStack = $requestStack;
}
const MAX_LENGTH = 'maxLength';
/**
@@ -33,7 +41,7 @@ class CustomFieldText implements CustomFieldInterface
: 'textarea';
$builder->add($customField->getSlug(), $type, array(
'label' => $customField->getLabel()
'label' => $customField->getName()[$this->requestStack->getCurrentRequest()->getLocale()]
));
}