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

0 commit comments

Comments
 (0)