@@ -428,37 +428,66 @@ public function testEntriesBlockPrefixes()
428
428
public function testEntriesBlockPrefixesWithCustomBlockPrefix ()
429
429
{
430
430
$ collectionView = $ this ->factory ->createNamed ('fields ' , static ::TESTED_TYPE , ['' ], [
431
+ 'allow_add ' => true ,
431
432
'entry_options ' => ['block_prefix ' => 'field ' ],
432
433
])
433
434
->createView ()
434
435
;
435
436
436
- $ this ->assertCount (1 , $ collectionView );
437
- $ this ->assertSame ([
437
+ $ expectedBlockPrefixes = [
438
438
'form ' ,
439
439
'collection_entry ' ,
440
440
'text ' ,
441
441
'field ' ,
442
442
'_fields_entry ' ,
443
- ], $ collectionView [0 ]->vars ['block_prefixes ' ]);
443
+ ];
444
+
445
+ $ this ->assertCount (1 , $ collectionView );
446
+ $ this ->assertSame ($ expectedBlockPrefixes , $ collectionView [0 ]->vars ['block_prefixes ' ]);
447
+ $ this ->assertSame ($ expectedBlockPrefixes , $ collectionView ->vars ['prototype ' ]->vars ['block_prefixes ' ]);
444
448
}
445
449
446
450
public function testEntriesBlockPrefixesWithCustomBlockPrefixedType ()
447
451
{
448
452
$ collectionView = $ this ->factory ->createNamed ('fields ' , static ::TESTED_TYPE , ['' ], [
453
+ 'allow_add ' => true ,
449
454
'entry_type ' => BlockPrefixedFooTextType::class,
450
455
])
451
456
->createView ()
452
457
;
453
458
454
- $ this ->assertCount (1 , $ collectionView );
455
- $ this ->assertSame ([
459
+ $ expectedBlockPrefixes = [
456
460
'form ' ,
457
461
'collection_entry ' ,
458
462
'block_prefixed_foo_text ' ,
459
463
'foo ' ,
460
464
'_fields_entry ' ,
461
- ], $ collectionView [0 ]->vars ['block_prefixes ' ]);
465
+ ];
466
+
467
+ $ this ->assertCount (1 , $ collectionView );
468
+ $ this ->assertSame ($ expectedBlockPrefixes , $ collectionView [0 ]->vars ['block_prefixes ' ]);
469
+ $ this ->assertSame ($ expectedBlockPrefixes , $ collectionView ->vars ['prototype ' ]->vars ['block_prefixes ' ]);
470
+ }
471
+
472
+ public function testPrototypeBlockPrefixesWithCustomBlockPrefix ()
473
+ {
474
+ $ collectionView = $ this ->factory ->createNamed ('fields ' , static ::TESTED_TYPE , [], [
475
+ 'allow_add ' => true ,
476
+ 'entry_options ' => ['block_prefix ' => 'field ' ],
477
+ ])
478
+ ->createView ()
479
+ ;
480
+
481
+ $ expectedBlockPrefixes = [
482
+ 'form ' ,
483
+ 'collection_entry ' ,
484
+ 'text ' ,
485
+ 'field ' ,
486
+ '_fields_entry ' ,
487
+ ];
488
+
489
+ $ this ->assertCount (0 , $ collectionView );
490
+ $ this ->assertSame ($ expectedBlockPrefixes , $ collectionView ->vars ['prototype ' ]->vars ['block_prefixes ' ]);
462
491
}
463
492
464
493
public function testSubmitNull ($ expected = null , $ norm = null , $ view = null )
0 commit comments