13
13
14
14
use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
15
15
use Twig \Environment ;
16
- use Twig \Error \SyntaxError ;
17
16
use Twig \Loader \ArrayLoader ;
18
17
use Twig \TemplateWrapper ;
19
18
@@ -63,45 +62,6 @@ public function testAcceptHtmlSelfClosingComponentTagWithValidComponentName(stri
63
62
self ::assertInstanceOf (TemplateWrapper::class, $ template );
64
63
}
65
64
66
- /**
67
- * @dataProvider provideInvalidComponentNames
68
- */
69
- public function testRejectTwigComponentTagWithInvalidComponentName (string $ name ): void
70
- {
71
- $ environment = self ::createEnvironment ();
72
- $ source = str_replace ('XXX ' , $ name , "{% component 'XXX' %}{% endcomponent %} " );
73
-
74
- self ::expectException (SyntaxError::class);
75
-
76
- $ template = $ environment ->createTemplate ($ source );
77
- }
78
-
79
- /**
80
- * @dataProvider provideInvalidComponentNames
81
- */
82
- public function testRejectHtmlComponentTagWithInvalidComponentName (string $ name ): void
83
- {
84
- $ environment = self ::createEnvironment ();
85
- $ source = sprintf ('<twig:%s></twig:%s> ' , $ name , $ name );
86
-
87
- self ::expectException (SyntaxError::class);
88
-
89
- $ template = $ environment ->createTemplate ($ source );
90
- }
91
-
92
- /**
93
- * @dataProvider provideInvalidComponentNames
94
- */
95
- public function testRejectHtmlSelfClosingComponentTagWithInvalidComponentName (string $ name ): void
96
- {
97
- $ environment = self ::createEnvironment ();
98
- $ source = sprintf ('<twig:%s /> ' , $ name );
99
-
100
- self ::expectException (SyntaxError::class);
101
-
102
- $ template = $ environment ->createTemplate ($ source );
103
- }
104
-
105
65
public static function provideValidComponentNames (): iterable
106
66
{
107
67
// Those names are all syntactically valid even if
@@ -118,20 +78,6 @@ public static function provideValidComponentNames(): iterable
118
78
}
119
79
}
120
80
121
- public static function provideInvalidComponentNames (): iterable
122
- {
123
- // TODO add expression syntaxes (?)
124
- // @see Twig\TokenParser\UseTokenParser
125
- $ names = [
126
- '' ,
127
- ' ' ,
128
- ];
129
-
130
- foreach ($ names as $ name ) {
131
- yield $ name => [$ name ];
132
- }
133
- }
134
-
135
81
private function createEnvironment (): Environment
136
82
{
137
83
/** @var Environment $environment */
0 commit comments