diff --git a/package.xml b/package.xml
index 371825f8ce..09ee3796d4 100644
--- a/package.xml
+++ b/package.xml
@@ -206,6 +206,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
+
@@ -1959,6 +1960,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
+
@@ -1994,6 +1996,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
+
diff --git a/tests/Core/AbstractMethodUnitTest.php b/tests/Core/AbstractMethodUnitTest.php
new file mode 100644
index 0000000000..45e7cc3680
--- /dev/null
+++ b/tests/Core/AbstractMethodUnitTest.php
@@ -0,0 +1,80 @@
+
+ * @copyright 2018-2019 Juliette Reinders Folmer. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Tests\Core;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Files\DummyFile;
+use PHPUnit\Framework\TestCase;
+
+abstract class AbstractMethodUnitTest extends TestCase
+{
+
+ /**
+ * The file extension of the test case file (without leading dot).
+ *
+ * This allows child classes to overrule the default `inc` with, for instance,
+ * `js` or `css` when applicable.
+ *
+ * @var string
+ */
+ protected static $fileExtension = 'inc';
+
+ /**
+ * The \PHP_CodeSniffer\Files\File object containing the parsed contents of the test case file.
+ *
+ * @var \PHP_CodeSniffer\Files\File
+ */
+ protected static $phpcsFile;
+
+
+ /**
+ * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
+ *
+ * The test case file for a unit test class has to be in the same directory
+ * directory and use the same file name as the test class, using the .inc extension.
+ *
+ * @return void
+ */
+ public static function setUpBeforeClass()
+ {
+ $config = new Config();
+ $config->standards = ['PSR1'];
+
+ $ruleset = new Ruleset($config);
+
+ // Default to a file with the same name as the test class. Extension is property based.
+ $relativeCN = str_replace(__NAMESPACE__, '', get_called_class());
+ $relativePath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeCN);
+ $pathToTestFile = realpath(__DIR__).$relativePath.'.'.static::$fileExtension;
+
+ // Make sure the file gets parsed correctly based on the file type.
+ $contents = 'phpcs_input_file: '.$pathToTestFile.PHP_EOL;
+ $contents .= file_get_contents($pathToTestFile);
+
+ self::$phpcsFile = new DummyFile($contents, $ruleset, $config);
+ self::$phpcsFile->process();
+
+ }//end setUpBeforeClass()
+
+
+ /**
+ * Clean up after finished test.
+ *
+ * @return void
+ */
+ public static function tearDownAfterClass()
+ {
+ self::$phpcsFile = null;
+
+ }//end tearDownAfterClass()
+
+
+}//end class