mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-20 09:14:23 +00:00
Tests/CustomFields/CustomFieldsTextTest.php : refactoring
This commit is contained in:
parent
0e5e87eb41
commit
b11a356fd3
@ -44,13 +44,9 @@ class CustomFieldsTextTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
static::bootKernel();
|
static::bootKernel();
|
||||||
$this->customFieldProvider = static::$kernel->getContainer()
|
$this->customFieldProvider = static::$kernel->getContainer()
|
||||||
->get('chill.custom_field.provider');
|
->get('chill.custom_field.provider');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function testCustomFieldsTextExists()
|
public function testCustomFieldsTextExists()
|
||||||
{
|
{
|
||||||
$customField = $this->customFieldProvider->getCustomFieldByType('text');
|
$customField = $this->customFieldProvider->getCustomFieldByType('text');
|
||||||
@ -65,31 +61,27 @@ class CustomFieldsTextTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
$customField = new CustomField();
|
$customField = new CustomField();
|
||||||
$customField->setType('text')
|
$customField->setType('text')
|
||||||
->setOptions(array(CustomFieldText::MAX_LENGTH => 255))
|
->setOptions(array(CustomFieldText::MAX_LENGTH => 255))
|
||||||
->setSlug('slug')
|
->setSlug('slug')
|
||||||
->setOrdering(10)
|
->setOrdering(10)
|
||||||
->setActive(true)
|
->setActive(true)
|
||||||
->setName(array('en' => 'my label'))
|
->setName(array('en' => 'my label'));
|
||||||
;
|
|
||||||
|
|
||||||
$crawler = CustomFieldTestHelper::getCrawlerForField($customField, $this, static::$kernel);
|
$crawler = CustomFieldTestHelper::getCrawlerForField($customField, $this, static::$kernel);
|
||||||
|
|
||||||
$this->assertCount(1, $crawler->filter("input[type=text]"));
|
$this->assertCount(1, $crawler->filter("input[type=text]"));
|
||||||
$this->assertCount(1, $crawler->filter("label:contains('my label')"));
|
$this->assertCount(1, $crawler->filter("label:contains('my label')"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPublicFormRenderingLengthMoreThan25()
|
public function testPublicFormRenderingLengthMoreThan25()
|
||||||
{
|
{
|
||||||
$customField = new CustomField();
|
$customField = new CustomField();
|
||||||
$customField->setType('text')
|
$customField->setType('text')
|
||||||
->setOptions(array(CustomFieldText::MAX_LENGTH => 256))
|
->setOptions(array(CustomFieldText::MAX_LENGTH => 256))
|
||||||
->setSlug('slug')
|
->setSlug('slug')
|
||||||
->setOrdering(10)
|
->setOrdering(10)
|
||||||
->setActive(true)
|
->setActive(true)
|
||||||
->setName(array('en' => 'my label'))
|
->setName(array('en' => 'my label'));
|
||||||
;
|
|
||||||
|
|
||||||
$crawler = CustomFieldTestHelper::getCrawlerForField($customField, $this, static::$kernel);
|
$crawler = CustomFieldTestHelper::getCrawlerForField($customField, $this, static::$kernel);
|
||||||
|
|
||||||
@ -108,5 +100,4 @@ class CustomFieldsTextTest extends WebTestCase
|
|||||||
$form = $crawler->selectButton('custom_field_choice_submit')->form();
|
$form = $crawler->selectButton('custom_field_choice_submit')->form();
|
||||||
$this->assertTrue($form->has('custom_field_choice[options][maxLength]'));
|
$this->assertTrue($form->has('custom_field_choice[options][maxLength]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user