Skip to content

Commit 494fa56

Browse files
authored
Test @use directive without quotes (#55462)
1 parent 48347e5 commit 494fa56

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tests/View/Blade/BladeUseTest.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,45 @@ class BladeUseTest extends AbstractBladeTestCase
66
{
77
public function testUseStatementsAreCompiled()
88
{
9-
$string = "Foo @use('SomeNamespace\SomeClass', 'Foo') bar";
109
$expected = "Foo <?php use \SomeNamespace\SomeClass as Foo; ?> bar";
10+
11+
$string = "Foo @use('SomeNamespace\SomeClass', 'Foo') bar";
12+
$this->assertEquals($expected, $this->compiler->compileString($string));
13+
14+
$string = "Foo @use(SomeNamespace\SomeClass, Foo) bar";
1115
$this->assertEquals($expected, $this->compiler->compileString($string));
1216
}
1317

1418
public function testUseStatementsWithoutAsAreCompiled()
1519
{
16-
$string = "Foo @use('SomeNamespace\SomeClass') bar";
1720
$expected = "Foo <?php use \SomeNamespace\SomeClass; ?> bar";
21+
22+
$string = "Foo @use('SomeNamespace\SomeClass') bar";
23+
$this->assertEquals($expected, $this->compiler->compileString($string));
24+
25+
$string = "Foo @use(SomeNamespace\SomeClass) bar";
1826
$this->assertEquals($expected, $this->compiler->compileString($string));
1927
}
2028

2129
public function testUseStatementsWithBackslashAtBeginningAreCompiled()
2230
{
23-
$string = "Foo @use('\SomeNamespace\SomeClass') bar";
2431
$expected = "Foo <?php use \SomeNamespace\SomeClass; ?> bar";
32+
33+
$string = "Foo @use('\SomeNamespace\SomeClass') bar";
34+
$this->assertEquals($expected, $this->compiler->compileString($string));
35+
36+
$string = "Foo @use(\SomeNamespace\SomeClass) bar";
2537
$this->assertEquals($expected, $this->compiler->compileString($string));
2638
}
2739

2840
public function testUseStatementsWithBackslashAtBeginningAndAliasedAreCompiled()
2941
{
30-
$string = "Foo @use('\SomeNamespace\SomeClass', 'Foo') bar";
3142
$expected = "Foo <?php use \SomeNamespace\SomeClass as Foo; ?> bar";
43+
44+
$string = "Foo @use('\SomeNamespace\SomeClass', 'Foo') bar";
45+
$this->assertEquals($expected, $this->compiler->compileString($string));
46+
47+
$string = "Foo @use(\SomeNamespace\SomeClass, Foo) bar";
3248
$this->assertEquals($expected, $this->compiler->compileString($string));
3349
}
3450
}

0 commit comments

Comments
 (0)