Skip to content

Commit c4c389c

Browse files
committed
AbstractMethodUnitTest: add "tear down" method to reset static properties
... to prevent changes to the values of these for one test, influencing another test. This is only a stability tweak, there are no existing tests affected by this issue at this time.
1 parent 329ad21 commit c4c389c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/Core/AbstractMethodUnitTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,25 @@ public static function initializeFile()
8080
}//end initializeFile()
8181

8282

83+
/**
84+
* Clean up after finished test by resetting all static properties on the class to their default values.
85+
*
86+
* Note: This is a PHPUnit cross-version compatible {@see \PHPUnit\Framework\TestCase::tearDownAfterClass()}
87+
* method.
88+
*
89+
* @afterClass
90+
*
91+
* @return void
92+
*/
93+
public static function reset()
94+
{
95+
self::$fileExtension = 'inc';
96+
self::$tabWidth = 4;
97+
self::$phpcsFile = null;
98+
99+
}//end reset()
100+
101+
83102
/**
84103
* Get the token pointer for a target token based on a specific comment found on the line before.
85104
*

0 commit comments

Comments
 (0)