-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c552527
commit bc38e06
Showing
6 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
tests/Rules/Function/NamedArgumentName/NamedArgumentNameRuleTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TwigCsFixer\Tests\Rules\Function\NamedArgumentName; | ||
|
||
use TwigCsFixer\Rules\Function\NamedArgumentNameRule; | ||
use TwigCsFixer\Test\AbstractRuleTestCase; | ||
|
||
final class NamedArgumentNameRuleTest extends AbstractRuleTestCase | ||
{ | ||
public function testConfiguration(): void | ||
{ | ||
static::assertSame( | ||
[ | ||
'case' => NamedArgumentNameRule::SNAKE_CASE, | ||
], | ||
(new NamedArgumentNameRule())->getConfiguration() | ||
); | ||
static::assertSame( | ||
[ | ||
'case' => NamedArgumentNameRule::CAMEL_CASE, | ||
], | ||
(new NamedArgumentNameRule(NamedArgumentNameRule::CAMEL_CASE))->getConfiguration() | ||
); | ||
} | ||
|
||
public function testRule(): void | ||
{ | ||
$this->checkRule(new NamedArgumentNameRule(), [ | ||
'NamedArgumentName.Error:1:28' => 'The named argument must use snake_case; expected baz_baz.', | ||
]); | ||
} | ||
|
||
public function testRulePascalCase(): void | ||
{ | ||
$this->checkRule(new NamedArgumentNameRule(NamedArgumentNameRule::PASCAL_CASE), [ | ||
'NamedArgumentName.Error:1:15' => 'The named argument must use PascalCase; expected BarBar.', | ||
'NamedArgumentName.Error:1:28' => 'The named argument must use PascalCase; expected BazBaz.', | ||
]); | ||
} | ||
|
||
public function testRuleCamelCase(): void | ||
{ | ||
$this->checkRule(new NamedArgumentNameRule(NamedArgumentNameRule::CAMEL_CASE), [ | ||
'NamedArgumentName.Error:1:15' => 'The named argument must use camelCase; expected barBar.', | ||
]); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
tests/Rules/Function/NamedArgumentName/NamedArgumentNameRuleTest.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{ foo(bar_bar=true, bazBaz: 42) }} | ||
{% macro foo(bar = true) %} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.