@@ -40,9 +40,9 @@ abstract class AbstractBootstrap5LayoutTest extends AbstractBootstrap4LayoutTest
40
40
{
41
41
public function testRow ()
42
42
{
43
- $ form = $ this ->factory ->createNamed ('name ' , TextType::class);
44
- $ form ->addError (new FormError ('[trans]Error![/trans] ' ));
45
- $ html = $ this ->renderRow ($ form ->createView ());
43
+ $ form = $ this ->factory ->createNamed ('' )-> add ( ' name ' , TextType::class);
44
+ $ form ->get ( ' name ' )-> addError (new FormError ('[trans]Error![/trans] ' ));
45
+ $ html = $ this ->renderRow ($ form ->get ( ' name ' )-> createView ());
46
46
47
47
$ this ->assertMatchesXpath ($ html ,
48
48
'/div
@@ -61,9 +61,9 @@ public function testRow()
61
61
62
62
public function testRowWithCustomClass ()
63
63
{
64
- $ form = $ this ->factory ->createNamed ('name ' , TextType::class);
65
- $ form ->addError (new FormError ('[trans]Error![/trans] ' ));
66
- $ html = $ this ->renderRow ($ form ->createView (), [
64
+ $ form = $ this ->factory ->createNamed ('' )-> add ( ' name ' , TextType::class);
65
+ $ form ->get ( ' name ' )-> addError (new FormError ('[trans]Error![/trans] ' ));
66
+ $ html = $ this ->renderRow ($ form ->get ( ' name ' )-> createView (), [
67
67
'row_attr ' => [
68
68
'class ' => 'mb-5 ' ,
69
69
],
@@ -309,11 +309,34 @@ public function testHelpHtmlIsTrue()
309
309
310
310
public function testErrors ()
311
311
{
312
- $ form = $ this ->factory ->createNamed ('name ' , TextType::class);
312
+ self ::markTestSkipped ('This method has been split into testRootErrors() and testRowErrors(). ' );
313
+ }
314
+
315
+ public function testRootErrors ()
316
+ {
317
+ $ form = $ this ->factory ->createNamed ('' );
313
318
$ form ->addError (new FormError ('[trans]Error 1[/trans] ' ));
314
319
$ form ->addError (new FormError ('[trans]Error 2[/trans] ' ));
315
320
$ html = $ this ->renderErrors ($ form ->createView ());
316
321
322
+ $ this ->assertMatchesXpath ($ html ,
323
+ '/div
324
+ [@class="alert alert-danger d-block"]
325
+ [.="[trans]Error 1[/trans]"]
326
+ /following-sibling::div
327
+ [@class="alert alert-danger d-block"]
328
+ [.="[trans]Error 2[/trans]"]
329
+ '
330
+ );
331
+ }
332
+
333
+ public function testRowErrors ()
334
+ {
335
+ $ form = $ this ->factory ->createNamed ('' )->add ('name ' , TextType::class);
336
+ $ form ->get ('name ' )->addError (new FormError ('[trans]Error 1[/trans] ' ));
337
+ $ form ->get ('name ' )->addError (new FormError ('[trans]Error 2[/trans] ' ));
338
+ $ html = $ this ->renderErrors ($ form ->get ('name ' )->createView ());
339
+
317
340
$ this ->assertMatchesXpath ($ html ,
318
341
'/div
319
342
[@class="invalid-feedback d-block"]
0 commit comments