1
1
<?php
2
2
/**
3
- * Tests deprecation of support for sniffs not implementing the PHPCS `Sniff` interface.
3
+ * Tests removed support for sniffs not implementing the PHPCS `Sniff` interface.
4
4
*
5
5
* @author Juliette Reinders Folmer <[email protected] >
6
6
* @copyright 2025 PHPCSStandards and contributors
11
11
12
12
use PHP_CodeSniffer \Ruleset ;
13
13
use PHP_CodeSniffer \Tests \ConfigDouble ;
14
- use PHPUnit \ Framework \ TestCase ;
14
+ use PHP_CodeSniffer \ Tests \ Core \ Ruleset \ AbstractRulesetTestCase ;
15
15
16
16
/**
17
- * Tests deprecation of support for sniffs not implementing the PHPCS `Sniff` interface.
17
+ * Tests removed support for sniffs not implementing the PHPCS `Sniff` interface.
18
18
*
19
19
* @covers \PHP_CodeSniffer\Ruleset::registerSniffs
20
20
*/
21
- final class RegisterSniffsMissingInterfaceTest extends TestCase
21
+ final class RegisterSniffsMissingInterfaceTest extends AbstractRulesetTestCase
22
22
{
23
23
24
24
@@ -41,25 +41,25 @@ public function testNoNoticesForSniffsImplementingInterface()
41
41
42
42
43
43
/**
44
- * Test that a deprecation notice is shown if a sniff doesn't implement the Sniff interface.
44
+ * Test that an error is shown if a sniff doesn't implement the Sniff interface.
45
45
*
46
46
* @return void
47
47
*/
48
- public function testDeprecationNoticeWhenSniffDoesntImplementInterface ()
48
+ public function testErrorWhenSniffDoesntImplementInterface ()
49
49
{
50
50
// Set up the ruleset.
51
51
$ standard = __DIR__ .'/RegisterSniffsMissingInterfaceInvalidTest.xml ' ;
52
52
$ config = new ConfigDouble (["--standard= $ standard " ]);
53
53
54
- $ expected = 'DEPRECATED : All sniffs must implement the PHP_CodeSniffer \\Sniffs \\Sniff interface. ' .PHP_EOL ;
54
+ $ expected = 'ERROR : All sniffs must implement the PHP_CodeSniffer \\Sniffs \\Sniff interface. ' .PHP_EOL ;
55
55
$ expected .= 'Interface not implemented for sniff Fixtures \\TestStandard \\Sniffs \\MissingInterface \\InvalidImplementsWithoutImplementSniff. ' .PHP_EOL ;
56
56
$ expected .= 'Contact the sniff author to fix the sniff. ' .PHP_EOL .PHP_EOL ;
57
57
58
- $ this ->expectOutputString ($ expected );
58
+ $ this ->expectRuntimeExceptionMessage ($ expected );
59
59
60
60
new Ruleset ($ config );
61
61
62
- }//end testDeprecationNoticeWhenSniffDoesntImplementInterface ()
62
+ }//end testErrorWhenSniffDoesntImplementInterface ()
63
63
64
64
65
65
}//end class
0 commit comments