| 1 | <?php |
||
| 15 | abstract class BaseAbstractClassMethodTest extends BaseSniffTest |
||
| 16 | { |
||
| 17 | |||
| 18 | public $filename; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * The PHP_CodeSniffer_File object containing parsed contents of this file. |
||
| 22 | * |
||
| 23 | * @var PHP_CodeSniffer_File |
||
| 24 | */ |
||
| 25 | protected $_phpcsFile; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * A wrapper for the abstract PHPCompatibility sniff. |
||
| 29 | * |
||
| 30 | * @var PHPCompatibility_Sniff |
||
| 31 | */ |
||
| 32 | protected $helperClass; |
||
| 33 | |||
| 34 | |||
| 35 | public static function setUpBeforeClass() |
||
| 36 | { |
||
| 37 | require_once dirname(__FILE__) . '/TestHelperPHPCompatibility.php'; |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function setUp() |
||
| 41 | { |
||
| 42 | parent::setUp(); |
||
| 43 | |||
| 44 | $this->helperClass = new TestHelperPHPCompatibility; |
||
| 45 | |||
| 46 | $filename = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $this->filename; |
||
| 47 | $phpcs = new PHP_CodeSniffer(); |
||
| 48 | |||
| 49 | if (version_compare(PHP_CodeSniffer::VERSION, '2.0', '<')) { |
||
| 50 | $this->_phpcsFile = new PHP_CodeSniffer_File( |
||
| 51 | $filename, |
||
| 52 | array(), |
||
| 53 | array(), |
||
| 54 | array(), |
||
| 55 | array(), |
||
| 56 | $phpcs |
||
| 57 | ); |
||
| 58 | } |
||
| 59 | else { |
||
| 60 | $this->_phpcsFile = new PHP_CodeSniffer_File( |
||
| 61 | $filename, |
||
| 62 | array(), |
||
| 63 | array(), |
||
| 64 | $phpcs |
||
| 65 | ); |
||
| 66 | } |
||
| 67 | |||
| 68 | $contents = file_get_contents($filename); |
||
| 69 | $this->_phpcsFile->start($contents); |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Clean up after finished test. |
||
| 74 | * |
||
| 75 | * @return void |
||
| 76 | */ |
||
| 77 | public function tearDown() |
||
| 78 | { |
||
| 79 | unset($this->_phpcsFile, $this->helperClass); |
||
| 80 | |||
| 81 | }//end tearDown() |
||
| 82 | |||
| 83 | } |
||
| 84 |