Skip to content

Commit 2ce314b

Browse files
authored
Merge pull request #49 from magento-commerce/imported-magento-magento-coding-standard-253
[Imported] AC-952: Create unit test for Magento2\Less\SemicolonSpacingSniff check
2 parents 4c366f4 + 1dd90d0 commit 2ce314b

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

Magento2/Sniffs/Less/SemicolonSpacingSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function validateSemicolon(File $phpcsFile, $stackPtr, array $tokens, $s
8383
{
8484
if ((false === $semicolonPtr || $tokens[$semicolonPtr]['line'] !== $tokens[$stackPtr]['line'])
8585
&& (isset($tokens[$stackPtr - 1]) && !in_array($tokens[$stackPtr - 1]['code'], $this->styleCodesToSkip))
86-
&& (T_COLON !== $tokens[$stackPtr + 1]['code'])
86+
&& (T_COLON !== $tokens[$stackPtr]['code'])
8787
) {
8888
$error = 'Style definitions must end with a semicolon';
8989
$phpcsFile->addError($error, $stackPtr, 'NotAtEnd');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// /**
2+
// * Copyright © Magento, Inc. All rights reserved.
3+
// * See COPYING.txt for license details.
4+
// */
5+
6+
.nav {
7+
background-color: green;
8+
}
9+
10+
.nav-list {
11+
background-color: red ;
12+
color: red
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento2\Tests\Less;
7+
8+
class SemicolonSpacingUnitTest extends AbstractLessSniffUnitTestCase
9+
{
10+
/**
11+
* @inheritdoc
12+
*/
13+
public function getErrorList()
14+
{
15+
return [
16+
11 => 1,
17+
12 => 1
18+
];
19+
}
20+
21+
/**
22+
* @inheritdoc
23+
*/
24+
public function getWarningList()
25+
{
26+
return [];
27+
}
28+
}

0 commit comments

Comments
 (0)