Skip to content

Commit 31eb80f

Browse files
committed
Unit tests: add @Covers annotation to all utility method tests
1 parent 40a4bd9 commit 31eb80f

19 files changed

+122
-6
lines changed

tests/Core/Autoloader/DetermineLoadedClassTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
use PHP_CodeSniffer\Autoload;
1313
use PHPUnit\Framework\TestCase;
1414

15+
/**
16+
* Tests for the \PHP_CodeSniffer\Autoload::determineLoadedClass method.
17+
*
18+
* @covers \PHP_CodeSniffer\Autoload::determineLoadedClass
19+
*/
1520
class DetermineLoadedClassTest extends TestCase
1621
{
1722

tests/Core/Config/ReportWidthTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
use PHPUnit\Framework\TestCase;
1414
use ReflectionProperty;
1515

16+
/**
17+
* Tests for the \PHP_CodeSniffer\Config reportWidth value.
18+
*
19+
* @covers \PHP_CodeSniffer\Config::__get
20+
*/
1621
class ReportWidthTest extends TestCase
1722
{
1823

@@ -76,6 +81,9 @@ public static function resetConfigToDefaults()
7681
/**
7782
* Test that report width without overrules will always be set to a non-0 positive integer.
7883
*
84+
* @covers \PHP_CodeSniffer\Config::__set
85+
* @covers \PHP_CodeSniffer\Config::restoreDefaults
86+
*
7987
* @return void
8088
*/
8189
public function testReportWidthDefault()
@@ -92,6 +100,9 @@ public function testReportWidthDefault()
92100
/**
93101
* Test that the report width will be set to a non-0 positive integer when not found in the CodeSniffer.conf file.
94102
*
103+
* @covers \PHP_CodeSniffer\Config::__set
104+
* @covers \PHP_CodeSniffer\Config::restoreDefaults
105+
*
95106
* @return void
96107
*/
97108
public function testReportWidthWillBeSetFromAutoWhenNotFoundInConfFile()
@@ -115,6 +126,10 @@ public function testReportWidthWillBeSetFromAutoWhenNotFoundInConfFile()
115126
/**
116127
* Test that the report width will be set correctly when found in the CodeSniffer.conf file.
117128
*
129+
* @covers \PHP_CodeSniffer\Config::__set
130+
* @covers \PHP_CodeSniffer\Config::getConfigData
131+
* @covers \PHP_CodeSniffer\Config::restoreDefaults
132+
*
118133
* @return void
119134
*/
120135
public function testReportWidthCanBeSetFromConfFile()
@@ -135,6 +150,9 @@ public function testReportWidthCanBeSetFromConfFile()
135150
/**
136151
* Test that the report width will be set correctly when passed as a CLI argument.
137152
*
153+
* @covers \PHP_CodeSniffer\Config::__set
154+
* @covers \PHP_CodeSniffer\Config::processLongArgument
155+
*
138156
* @return void
139157
*/
140158
public function testReportWidthCanBeSetFromCLI()
@@ -153,6 +171,9 @@ public function testReportWidthCanBeSetFromCLI()
153171
/**
154172
* Test that the report width will be set correctly when multiple report widths are passed on the CLI.
155173
*
174+
* @covers \PHP_CodeSniffer\Config::__set
175+
* @covers \PHP_CodeSniffer\Config::processLongArgument
176+
*
156177
* @return void
157178
*/
158179
public function testReportWidthWhenSetFromCLIFirstValuePrevails()
@@ -172,6 +193,10 @@ public function testReportWidthWhenSetFromCLIFirstValuePrevails()
172193
/**
173194
* Test that a report width passed as a CLI argument will overrule a report width set in a CodeSniffer.conf file.
174195
*
196+
* @covers \PHP_CodeSniffer\Config::__set
197+
* @covers \PHP_CodeSniffer\Config::processLongArgument
198+
* @covers \PHP_CodeSniffer\Config::getConfigData
199+
*
175200
* @return void
176201
*/
177202
public function testReportWidthSetFromCLIOverrulesConfFile()
@@ -200,6 +225,8 @@ public function testReportWidthSetFromCLIOverrulesConfFile()
200225
/**
201226
* Test that the report width will be set to a non-0 positive integer when set to "auto".
202227
*
228+
* @covers \PHP_CodeSniffer\Config::__set
229+
*
203230
* @return void
204231
*/
205232
public function testReportWidthInputHandlingForAuto()
@@ -221,6 +248,7 @@ public function testReportWidthInputHandlingForAuto()
221248
* @param int $expected Expected report width.
222249
*
223250
* @dataProvider dataReportWidthInputHandling
251+
* @covers \PHP_CodeSniffer\Config::__set
224252
*
225253
* @return void
226254
*/

tests/Core/ErrorSuppressionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
use PHP_CodeSniffer\Files\DummyFile;
1515
use PHPUnit\Framework\TestCase;
1616

17+
/**
18+
* Tests for PHP_CodeSniffer error suppression tags.
19+
*
20+
* @coversNothing
21+
*/
1722
class ErrorSuppressionTest extends TestCase
1823
{
1924

tests/Core/File/FindEndOfStatementTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests for the \PHP_CodeSniffer\Files\File:findEndOfStatement method.
3+
* Tests for the \PHP_CodeSniffer\Files\File::findEndOfStatement method.
44
*
55
* @author Greg Sherwood <[email protected]>
66
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::findEndOfStatement method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::findEndOfStatement
18+
*/
1419
class FindEndOfStatementTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/FindExtendedClassNameTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests for the \PHP_CodeSniffer\Files\File:findExtendedClassName method.
3+
* Tests for the \PHP_CodeSniffer\Files\File::findExtendedClassName method.
44
*
55
* @author Greg Sherwood <[email protected]>
66
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::findExtendedClassName method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::findExtendedClassName
18+
*/
1419
class FindExtendedClassNameTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/FindImplementedInterfaceNamesTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests for the \PHP_CodeSniffer\Files\File:findImplementedInterfaceNames method.
3+
* Tests for the \PHP_CodeSniffer\Files\File::findImplementedInterfaceNames method.
44
*
55
* @author Greg Sherwood <[email protected]>
66
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::findImplementedInterfaceNames method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::findImplementedInterfaceNames
18+
*/
1419
class FindImplementedInterfaceNamesTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/FindStartOfStatementTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File:findStartOfStatement method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::findStartOfStatement
18+
*/
1419
class FindStartOfStatementTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/GetClassPropertiesTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File:getClassProperties method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::getClassProperties
18+
*/
1419
class GetClassPropertiesTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/GetMemberPropertiesTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::getMemberProperties method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::getMemberProperties
18+
*/
1419
class GetMemberPropertiesTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/GetMethodParametersTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests for the \PHP_CodeSniffer\Files\File:getMethodParameters method.
3+
* Tests for the \PHP_CodeSniffer\Files\File::getMethodParameters method.
44
*
55
* @author Greg Sherwood <[email protected]>
66
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::getMethodParameters method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::getMethodParameters
18+
*/
1419
class GetMethodParametersTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/GetMethodPropertiesTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests for the \PHP_CodeSniffer\Files\File:getMethodProperties method.
3+
* Tests for the \PHP_CodeSniffer\Files\File::getMethodProperties method.
44
*
55
* @author Greg Sherwood <[email protected]>
66
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::getMethodProperties method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::getMethodProperties
18+
*/
1419
class GetMethodPropertiesTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/File/IsReferenceTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests for the \PHP_CodeSniffer\Files\File:isReference method.
3+
* Tests for the \PHP_CodeSniffer\Files\File::isReference method.
44
*
55
* @author Greg Sherwood <[email protected]>
66
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Files\File::isReference method.
16+
*
17+
* @covers \PHP_CodeSniffer\Files\File::isReference
18+
*/
1419
class IsReferenceTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/Filters/Filter/AcceptTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
use PHP_CodeSniffer\Ruleset;
1616
use PHPUnit\Framework\TestCase;
1717

18+
/**
19+
* Tests for the \PHP_CodeSniffer\Filters\Filter::accept method.
20+
*
21+
* @covers \PHP_CodeSniffer\Filters\Filter
22+
*/
1823
class AcceptTest extends TestCase
1924
{
2025

tests/Core/IsCamelCapsTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
use PHP_CodeSniffer\Util\Common;
1313
use PHPUnit\Framework\TestCase;
1414

15+
/**
16+
* Tests for the \PHP_CodeSniffer\Util\Common::isCamelCaps method.
17+
*
18+
* @covers \PHP_CodeSniffer\Util\Common::isCamelCaps
19+
*/
1520
class IsCamelCapsTest extends TestCase
1621
{
1722

tests/Core/Ruleset/RuleInclusionAbsoluteLinuxTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
use PHP_CodeSniffer\Ruleset;
1414
use PHPUnit\Framework\TestCase;
1515

16+
/**
17+
* Tests for the \PHP_CodeSniffer\Ruleset class using a Linux-style absolute path to include a sniff.
18+
*
19+
* @covers \PHP_CodeSniffer\Ruleset
20+
*/
1621
class RuleInclusionAbsoluteLinuxTest extends TestCase
1722
{
1823

tests/Core/Ruleset/RuleInclusionAbsoluteWindowsTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
use PHP_CodeSniffer\Ruleset;
1414
use PHPUnit\Framework\TestCase;
1515

16+
/**
17+
* Tests for the \PHP_CodeSniffer\Ruleset class using a Windows-style absolute path to include a sniff.
18+
*
19+
* @covers \PHP_CodeSniffer\Ruleset
20+
*/
1621
class RuleInclusionAbsoluteWindowsTest extends TestCase
1722
{
1823

tests/Core/Ruleset/RuleInclusionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
use PHPUnit\Framework\TestCase;
1515
use ReflectionObject;
1616

17+
/**
18+
* Tests for the \PHP_CodeSniffer\Ruleset class.
19+
*
20+
* @covers \PHP_CodeSniffer\Ruleset
21+
*/
1722
class RuleInclusionTest extends TestCase
1823
{
1924

tests/Core/Sniffs/AbstractArraySniffTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
1313

14+
/**
15+
* Tests for the \PHP_CodeSniffer\Sniffs\AbstractArraySniff.
16+
*
17+
* @covers \PHP_CodeSniffer\Sniffs\AbstractArraySniff
18+
*/
1419
class AbstractArraySniffTest extends AbstractMethodUnitTest
1520
{
1621

tests/Core/Tokenizer/DefaultKeywordTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ public function dataNotDefaultKeyword()
283283
*
284284
* @link https://github.com/squizlabs/PHP_CodeSniffer/issues/3326
285285
*
286+
* @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
287+
* @covers PHP_CodeSniffer\Tokenizers\Tokenizer::recurseScopeMap
288+
*
286289
* @return void
287290
*/
288291
public function testIssue3326()

0 commit comments

Comments
 (0)