@@ -42,11 +42,9 @@ abstract class AbstractMethodUnitTest extends TestCase
4242 * The test case file for a unit test class has to be in the same directory
4343 * directory and use the same file name as the test class, using the .inc extension.
4444 *
45- * @beforeClass
46- *
4745 * @return void
4846 */
49- public static function initializeFile ()
47+ public static function setUpBeforeClass (): void
5048 {
5149 $ _SERVER ['argv ' ] = [];
5250 $ config = new ConfigDouble ();
@@ -67,20 +65,15 @@ public static function initializeFile()
6765 self ::$ phpcsFile = new DummyFile ($ contents , $ ruleset , $ config );
6866 self ::$ phpcsFile ->parse ();
6967
70- }//end initializeFile ()
68+ }//end setUpBeforeClass ()
7169
7270
7371 /**
7472 * Clean up after finished test by resetting all static properties on the class to their default values.
7573 *
76- * Note: This is a PHPUnit cross-version compatible {@see \PHPUnit\Framework\TestCase::tearDownAfterClass()}
77- * method.
78- *
79- * @afterClass
80- *
8174 * @return void
8275 */
83- public static function reset ()
76+ public static function tearDownAfterClass (): void
8477 {
8578 // Explicitly trigger __destruct() on the ConfigDouble to reset the Config statics.
8679 // The explicit method call prevents potential stray test-local references to the $config object
@@ -93,7 +86,7 @@ public static function reset()
9386 self ::$ tabWidth = 4 ;
9487 self ::$ phpcsFile = null ;
9588
96- }//end reset ()
89+ }//end tearDownAfterClass ()
9790
9891
9992 /**
@@ -246,16 +239,8 @@ public static function getTargetTokenFromFile(File $phpcsFile, $commentString, $
246239 */
247240 public function expectRunTimeException ($ message )
248241 {
249- $ exception = 'PHP_CodeSniffer\Exceptions\RuntimeException ' ;
250-
251- if (method_exists ($ this , 'expectException ' ) === true ) {
252- // PHPUnit 5+.
253- $ this ->expectException ($ exception );
254- $ this ->expectExceptionMessage ($ message );
255- } else {
256- // PHPUnit 4.
257- $ this ->setExpectedException ($ exception , $ message );
258- }
242+ $ this ->expectException ('PHP_CodeSniffer\Exceptions\RuntimeException ' );
243+ $ this ->expectExceptionMessage ($ message );
259244
260245 }//end expectRunTimeException()
261246
0 commit comments