Skip to content

Commit e4698fb

Browse files
committed
AC-667: Create phpcs static check for EmailTemplateTest
1 parent 4a78a94 commit e4698fb

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

Magento2/Sniffs/Legacy/EmailTemplateSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class EmailTemplateSniff implements Sniff
1919
'/\{\{escapehtml.*?\}\}/i' => 'Directive {{escapehtml}} is obsolete. Use {{var}} instead.',
2020
];
2121

22-
private const WARNING_CODE = 'FoundObsoleteEmailDirective';
22+
private const ERROR_CODE = 'FoundObsoleteEmailDirective';
2323

2424
/**
2525
* @inheritdoc
@@ -39,10 +39,10 @@ public function process(File $phpcsFile, $stackPtr)
3939
$content = $phpcsFile->getTokens()[$stackPtr]['content'];
4040
foreach (self::OBSOLETE_EMAIL_DIRECTIVES as $directiveRegex => $errorMessage) {
4141
if (preg_match($directiveRegex, $content)) {
42-
$phpcsFile->addWarning(
42+
$phpcsFile->addError(
4343
$errorMessage,
4444
$stackPtr,
45-
self::WARNING_CODE
45+
self::ERROR_CODE
4646
);
4747
}
4848
}

Magento2/Tests/Legacy/EmailTemplateUnitTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,7 @@ class EmailTemplateUnitTest extends AbstractSniffUnitTest
1313
/**
1414
* @inheritdoc
1515
*/
16-
public function getErrorList()
17-
{
18-
return [];
19-
}
20-
21-
/**
22-
* @inheritdoc
23-
*/
24-
public function getWarningList($testFile = '')
16+
public function getErrorList($testFile = '')
2517
{
2618
if ($testFile === 'EmailTemplateUnitTest.1.html') {
2719
return [];
@@ -36,4 +28,12 @@ public function getWarningList($testFile = '')
3628

3729
return [];
3830
}
31+
32+
/**
33+
* @inheritdoc
34+
*/
35+
public function getWarningList($testFile = '')
36+
{
37+
return [];
38+
}
3939
}

Magento2/ruleset.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,11 @@
241241
<severity>8</severity>
242242
<type>warning</type>
243243
</rule>
244-
245244
<rule ref="Magento2.Legacy.EmailTemplate.FoundObsoleteEmailDirective">
246245
<include-pattern>view/email/*.html</include-pattern>
247246
<include-pattern>view/*/email/*.html</include-pattern>
248247
<severity>8</severity>
249-
<type>warning</type>
248+
<type>error</type>
250249
</rule>
251250

252251
<!-- Severity 7 warnings: General code issues. -->

0 commit comments

Comments
 (0)