[Form] Make tested features configurable
This commit is contained in:
parent
d1be9d04d7
commit
c584b3c697
|
@ -27,6 +27,10 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
|
|||
*/
|
||||
protected $extension;
|
||||
|
||||
protected $testableFeatures = array(
|
||||
'choice_attr',
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
|
|
@ -28,6 +28,10 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
|
|||
*/
|
||||
protected $extension;
|
||||
|
||||
protected $testableFeatures = array(
|
||||
'choice_attr',
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
|
|
@ -27,6 +27,10 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
|
|||
*/
|
||||
protected $extension;
|
||||
|
||||
protected $testableFeatures = array(
|
||||
'choice_attr',
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
|
|
@ -27,6 +27,10 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
|
|||
*/
|
||||
protected $engine;
|
||||
|
||||
protected $testableFeatures = array(
|
||||
'choice_attr',
|
||||
);
|
||||
|
||||
protected function getExtensions()
|
||||
{
|
||||
// should be moved to the Form component once absolute file paths are supported
|
||||
|
|
|
@ -27,6 +27,10 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
|
|||
*/
|
||||
protected $engine;
|
||||
|
||||
protected $testableFeatures = array(
|
||||
'choice_attr',
|
||||
);
|
||||
|
||||
protected function getExtensions()
|
||||
{
|
||||
// should be moved to the Form component once absolute file paths are supported
|
||||
|
|
|
@ -18,6 +18,7 @@ use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
|
|||
abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormIntegrationTestCase
|
||||
{
|
||||
protected $csrfTokenManager;
|
||||
protected $testableFeatures = array();
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
|
@ -521,13 +522,15 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||
'expanded' => false,
|
||||
));
|
||||
|
||||
$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
'/select
|
||||
[@name="name"]
|
||||
[not(@required)]
|
||||
[
|
||||
./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
|
||||
/following-sibling::option[@value="&b"][@class="foo&bar"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||
/following-sibling::option[@value="&b"]'.$classPart.'[not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||
]
|
||||
[count(./option)=2]
|
||||
'
|
||||
|
@ -804,6 +807,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||
'expanded' => false,
|
||||
));
|
||||
|
||||
$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
'/select
|
||||
[@name="name[]"]
|
||||
|
@ -811,7 +816,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||
[@multiple="multiple"]
|
||||
[
|
||||
./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
|
||||
/following-sibling::option[@value="&b"][@class="foo&bar"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||
/following-sibling::option[@value="&b"]'.$classPart.'[not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||
]
|
||||
[count(./option)=2]
|
||||
'
|
||||
|
@ -893,12 +898,14 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||
'expanded' => true,
|
||||
));
|
||||
|
||||
$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
'/div
|
||||
[
|
||||
./input[@type="radio"][@name="name"][@id="name_0"][@value="&a"][@checked]
|
||||
/following-sibling::label[@for="name_0"][.="[trans]Choice&A[/trans]"]
|
||||
/following-sibling::input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][@class="foo&bar"][not(@checked)]
|
||||
/following-sibling::input[@type="radio"][@name="name"][@id="name_1"][@value="&b"]'.$classPart.'[not(@checked)]
|
||||
/following-sibling::label[@for="name_1"][.="[trans]Choice&B[/trans]"]
|
||||
/following-sibling::input[@type="hidden"][@id="name__token"]
|
||||
]
|
||||
|
@ -989,12 +996,14 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||
'required' => true,
|
||||
));
|
||||
|
||||
$classPart = in_array('choice_attr', $this->testableFeatures) ? '[@class="foo&bar"]' : '';
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
'/div
|
||||
[
|
||||
./input[@type="checkbox"][@name="name[]"][@id="name_0"][@checked][not(@required)]
|
||||
/following-sibling::label[@for="name_0"][.="[trans]Choice&A[/trans]"]
|
||||
/following-sibling::input[@type="checkbox"][@name="name[]"][@id="name_1"][@class="foo&bar"][not(@checked)][not(@required)]
|
||||
/following-sibling::input[@type="checkbox"][@name="name[]"][@id="name_1"]'.$classPart.'[not(@checked)][not(@required)]
|
||||
/following-sibling::label[@for="name_1"][.="[trans]Choice&B[/trans]"]
|
||||
/following-sibling::input[@type="checkbox"][@name="name[]"][@id="name_2"][@checked][not(@required)]
|
||||
/following-sibling::label[@for="name_2"][.="[trans]Choice&C[/trans]"]
|
||||
|
|
Reference in New Issue