Skip to content

Commit ac8474b

Browse files
committed
Clean Parser test
1 parent e851e58 commit ac8474b

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

src/TwigComponent/tests/Integration/Twig/ComponentParserTest.php

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1515
use Twig\Environment;
16-
use Twig\Error\SyntaxError;
1716
use Twig\Loader\ArrayLoader;
1817
use Twig\TemplateWrapper;
1918

@@ -63,45 +62,6 @@ public function testAcceptHtmlSelfClosingComponentTagWithValidComponentName(stri
6362
self::assertInstanceOf(TemplateWrapper::class, $template);
6463
}
6564

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-
10565
public static function provideValidComponentNames(): iterable
10666
{
10767
// Those names are all syntactically valid even if
@@ -118,20 +78,6 @@ public static function provideValidComponentNames(): iterable
11878
}
11979
}
12080

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-
13581
private function createEnvironment(): Environment
13682
{
13783
/** @var Environment $environment */

0 commit comments

Comments
 (0)