Skip to content

Commit f0fc16b

Browse files
author
Igor Melnikov
committed
MAGETWO-61240: Fix \Magento\Sniffs\Translation\ConstantUsageSniff
Fixing static test
1 parent 7da9b37 commit f0fc16b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

dev/tests/static/framework/Magento/Sniffs/Translation/ConstantUsageSniff.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ public function register()
2727
}
2828

2929
/**
30-
* Copied from \Generic_Sniffs_Files_LineLengthSniff
30+
* Copied from \Generic_Sniffs_Files_LineLengthSniff, minor changes made
3131
*
3232
* {@inheritDoc}
3333
*/
3434
public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
3535
{
3636
$tokens = $phpcsFile->getTokens();
3737

38-
// Make sure this is the first open tag.
38+
// Make sure this is the first open tag
3939
$previousOpenTag = $phpcsFile->findPrevious(T_OPEN_TAG, ($stackPtr - 1));
4040
if ($previousOpenTag !== false) {
4141
return;
@@ -45,19 +45,16 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
4545
$currentLineContent = '';
4646
$currentLine = 1;
4747

48-
$trim = (strlen($phpcsFile->eolChar) * -1);
4948
for (; $tokenCount < $phpcsFile->numTokens; $tokenCount++) {
5049
if ($tokens[$tokenCount]['line'] === $currentLine) {
5150
$currentLineContent .= $tokens[$tokenCount]['content'];
5251
} else {
53-
$currentLineContent = substr($currentLineContent, 0, $trim);
5452
$this->checkIfFirstArgumentConstant($phpcsFile, ($tokenCount - 1), $currentLineContent);
5553
$currentLineContent = $tokens[$tokenCount]['content'];
5654
$currentLine++;
5755
}
5856
}
5957

60-
$currentLineContent = substr($currentLineContent, 0, $trim);
6158
$this->checkIfFirstArgumentConstant($phpcsFile, ($tokenCount - 1), $currentLineContent);
6259
}
6360

dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function testProcessIncorrectArguments($file, $numIncorrectUsages)
4343
$this->fileMock->expects($this->once())
4444
->method('getTokens')
4545
->willReturn($tokens);
46-
$this->fileMock->eolChar = 2;
4746
$this->fileMock->numTokens = count($tokens);
4847
$this->fileMock->expects($this->exactly($numIncorrectUsages))
4948
->method('addError')

0 commit comments

Comments
 (0)