-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functional tests for simple buttons and collection form added
- Loading branch information
Showing
6 changed files
with
266 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
namespace Tests\Boekkooi\Bundle\JqueryValidationBundle\Functional\TestBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\Validator\Constraints; | ||
|
||
/** | ||
* @author Warnar Boekkooi <warnar@boekkooi.net> | ||
*/ | ||
class ButtonsFormType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add('title', null, array( | ||
'constraints' => array( | ||
new Constraints\NotBlank(array('groups' => array('main', 'Default'))), | ||
new Constraints\Length(array( | ||
'min' => 8, | ||
'max' => 200, | ||
'groups' => 'main' | ||
)) | ||
) | ||
)) | ||
->add('content', 'textarea', array( | ||
'constraints' => array( | ||
new Constraints\NotBlank(), | ||
new Constraints\Length(array( | ||
'min' => 8, | ||
'max' => 200, | ||
'groups' => 'never_used' | ||
)) | ||
) | ||
)) | ||
->add('defaultValidation', 'submit') | ||
->add('mainValidation', 'submit', array( | ||
'validation_groups' => 'main', | ||
)) | ||
->add('noValidation', 'submit', array( | ||
'validation_groups' => false, | ||
)) | ||
; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return 'buttons'; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
tests/Functional/TestBundle/Form/Type/CollectionFormType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
namespace Tests\Boekkooi\Bundle\JqueryValidationBundle\Functional\TestBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
use Symfony\Component\Validator\Constraints; | ||
|
||
/** | ||
* @author Warnar Boekkooi <warnar@boekkooi.net> | ||
*/ | ||
class CollectionFormType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add('title', null, array( | ||
'constraints' => array( | ||
new Constraints\NotBlank(), | ||
new Constraints\Length(array( | ||
'min' => 8, | ||
'max' => 200, | ||
)) | ||
) | ||
)) | ||
->add('tags', 'collection', array( | ||
'type' => 'text', | ||
'constraints' => array( | ||
new Constraints\Count(array( | ||
'min' => 1, | ||
'max' => 5 | ||
)) | ||
), | ||
|
||
'allow_add' => true, | ||
'allow_delete' => true, | ||
|
||
'prototype' => true, | ||
'prototype_name' => 'tag__name__', | ||
'options' => array( | ||
'constraints' => array( | ||
new Constraints\NotBlank() | ||
) | ||
) | ||
)) | ||
; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return 'collection'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters