Skip to content

Commit ec86223

Browse files
committed
(finally) fix version dependent Form tests
1 parent 736a136 commit ec86223

File tree

3 files changed

+3
-231
lines changed

3 files changed

+3
-231
lines changed

Tests/Extension/AbstractBootstrap3LayoutTest.php

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
1818
{
19-
protected static $supportedFeatureSetVersion = 304;
19+
protected static $supportedFeatureSetVersion = 403;
2020

2121
public function testLabelOnForm()
2222
{
@@ -2672,82 +2672,6 @@ public function testColor()
26722672
[@name="name"]
26732673
[@class="my&class form-control"]
26742674
[@value="#0000ff"]
2675-
'
2676-
);
2677-
}
2678-
2679-
public function testLabelWithTranslationParameters()
2680-
{
2681-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
2682-
$html = $this->renderLabel($form->createView(), 'Address is %address%', [
2683-
'label_translation_parameters' => [
2684-
'%address%' => 'Paris, rue de la Paix',
2685-
],
2686-
]);
2687-
2688-
$this->assertMatchesXpath($html,
2689-
'/label
2690-
[@for="name"]
2691-
[.="[trans]Address is Paris, rue de la Paix[/trans]"]
2692-
'
2693-
);
2694-
}
2695-
2696-
public function testHelpWithTranslationParameters()
2697-
{
2698-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
2699-
'help' => 'for company %company%',
2700-
'help_translation_parameters' => [
2701-
'%company%' => 'ACME Ltd.',
2702-
],
2703-
]);
2704-
$html = $this->renderHelp($form->createView());
2705-
2706-
$this->assertMatchesXpath($html,
2707-
'/*
2708-
[@id="name_help"]
2709-
[.="[trans]for company ACME Ltd.[/trans]"]
2710-
'
2711-
);
2712-
}
2713-
2714-
public function testAttributesWithTranslationParameters()
2715-
{
2716-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
2717-
'attr' => [
2718-
'title' => 'Message to %company%',
2719-
'placeholder' => 'Enter a message to %company%',
2720-
],
2721-
'attr_translation_parameters' => [
2722-
'%company%' => 'ACME Ltd.',
2723-
],
2724-
]);
2725-
$html = $this->renderWidget($form->createView());
2726-
2727-
$this->assertMatchesXpath($html,
2728-
'/input
2729-
[@title="[trans]Message to ACME Ltd.[/trans]"]
2730-
[@placeholder="[trans]Enter a message to ACME Ltd.[/trans]"]
2731-
'
2732-
);
2733-
}
2734-
2735-
public function testButtonWithTranslationParameters()
2736-
{
2737-
$form = $this->factory->createNamedBuilder('myform')
2738-
->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', [
2739-
'label' => 'Submit to %company%',
2740-
'label_translation_parameters' => [
2741-
'%company%' => 'ACME Ltd.',
2742-
],
2743-
])
2744-
->getForm();
2745-
$view = $form->get('mybutton')->createView();
2746-
$html = $this->renderWidget($view, ['label_format' => 'form.%name%']);
2747-
2748-
$this->assertMatchesXpath($html,
2749-
'/button
2750-
[.="[trans]Submit to ACME Ltd.[/trans]"]
27512675
'
27522676
);
27532677
}

Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
3131
*/
3232
private $renderer;
3333

34-
protected static $supportedFeatureSetVersion = 304;
34+
protected static $supportedFeatureSetVersion = 403;
3535

3636
protected function setUp()
3737
{
@@ -295,82 +295,6 @@ public function testHelpHtmlIsTrue()
295295
);
296296
}
297297

298-
public function testLabelWithTranslationParameters()
299-
{
300-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
301-
$html = $this->renderLabel($form->createView(), 'Address is %address%', [
302-
'label_translation_parameters' => [
303-
'%address%' => 'Paris, rue de la Paix',
304-
],
305-
]);
306-
307-
$this->assertMatchesXpath($html,
308-
'/label
309-
[@for="name"]
310-
[.="[trans]Address is Paris, rue de la Paix[/trans]"]
311-
'
312-
);
313-
}
314-
315-
public function testHelpWithTranslationParameters()
316-
{
317-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
318-
'help' => 'for company %company%',
319-
'help_translation_parameters' => [
320-
'%company%' => 'ACME Ltd.',
321-
],
322-
]);
323-
$html = $this->renderHelp($form->createView());
324-
325-
$this->assertMatchesXpath($html,
326-
'/*
327-
[@id="name_help"]
328-
[.="[trans]for company ACME Ltd.[/trans]"]
329-
'
330-
);
331-
}
332-
333-
public function testAttributesWithTranslationParameters()
334-
{
335-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
336-
'attr' => [
337-
'title' => 'Message to %company%',
338-
'placeholder' => 'Enter a message to %company%',
339-
],
340-
'attr_translation_parameters' => [
341-
'%company%' => 'ACME Ltd.',
342-
],
343-
]);
344-
$html = $this->renderWidget($form->createView());
345-
346-
$this->assertMatchesXpath($html,
347-
'/input
348-
[@title="[trans]Message to ACME Ltd.[/trans]"]
349-
[@placeholder="[trans]Enter a message to ACME Ltd.[/trans]"]
350-
'
351-
);
352-
}
353-
354-
public function testButtonWithTranslationParameters()
355-
{
356-
$form = $this->factory->createNamedBuilder('myform')
357-
->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', [
358-
'label' => 'Submit to %company%',
359-
'label_translation_parameters' => [
360-
'%company%' => 'ACME Ltd.',
361-
],
362-
])
363-
->getForm();
364-
$view = $form->get('mybutton')->createView();
365-
$html = $this->renderWidget($view, ['label_format' => 'form.%name%']);
366-
367-
$this->assertMatchesXpath($html,
368-
'/button
369-
[.="[trans]Submit to ACME Ltd.[/trans]"]
370-
'
371-
);
372-
}
373-
374298
protected function renderForm(FormView $view, array $vars = [])
375299
{
376300
return (string) $this->renderer->renderBlock($view, 'form', $vars);

Tests/Extension/FormExtensionTableLayoutTest.php

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
3030
*/
3131
private $renderer;
3232

33-
protected static $supportedFeatureSetVersion = 304;
33+
protected static $supportedFeatureSetVersion = 403;
3434

3535
protected function setUp()
3636
{
@@ -181,82 +181,6 @@ public function testHelpHtmlIsTrue()
181181
);
182182
}
183183

184-
public function testLabelWithTranslationParameters()
185-
{
186-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
187-
$html = $this->renderLabel($form->createView(), 'Address is %address%', [
188-
'label_translation_parameters' => [
189-
'%address%' => 'Paris, rue de la Paix',
190-
],
191-
]);
192-
193-
$this->assertMatchesXpath($html,
194-
'/label
195-
[@for="name"]
196-
[.="[trans]Address is Paris, rue de la Paix[/trans]"]
197-
'
198-
);
199-
}
200-
201-
public function testHelpWithTranslationParameters()
202-
{
203-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
204-
'help' => 'for company %company%',
205-
'help_translation_parameters' => [
206-
'%company%' => 'ACME Ltd.',
207-
],
208-
]);
209-
$html = $this->renderHelp($form->createView());
210-
211-
$this->assertMatchesXpath($html,
212-
'/*
213-
[@id="name_help"]
214-
[.="[trans]for company ACME Ltd.[/trans]"]
215-
'
216-
);
217-
}
218-
219-
public function testAttributesWithTranslationParameters()
220-
{
221-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
222-
'attr' => [
223-
'title' => 'Message to %company%',
224-
'placeholder' => 'Enter a message to %company%',
225-
],
226-
'attr_translation_parameters' => [
227-
'%company%' => 'ACME Ltd.',
228-
],
229-
]);
230-
$html = $this->renderWidget($form->createView());
231-
232-
$this->assertMatchesXpath($html,
233-
'/input
234-
[@title="[trans]Message to ACME Ltd.[/trans]"]
235-
[@placeholder="[trans]Enter a message to ACME Ltd.[/trans]"]
236-
'
237-
);
238-
}
239-
240-
public function testButtonWithTranslationParameters()
241-
{
242-
$form = $this->factory->createNamedBuilder('myform')
243-
->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', [
244-
'label' => 'Submit to %company%',
245-
'label_translation_parameters' => [
246-
'%company%' => 'ACME Ltd.',
247-
],
248-
])
249-
->getForm();
250-
$view = $form->get('mybutton')->createView();
251-
$html = $this->renderWidget($view, ['label_format' => 'form.%name%']);
252-
253-
$this->assertMatchesXpath($html,
254-
'/button
255-
[.="[trans]Submit to ACME Ltd.[/trans]"]
256-
'
257-
);
258-
}
259-
260184
protected function renderForm(FormView $view, array $vars = [])
261185
{
262186
return (string) $this->renderer->renderBlock($view, 'form', $vars);

0 commit comments

Comments
 (0)