Completed
Branch feature/scrutinizer-run-tests (072b5a)
by Juliette
10:12
created

BaseAbstractClassMethodTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 4
dl 0
loc 69
rs 10
1
<?php
2
/**
3
 * Base class to use when testing methods in the Sniff.php file.
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Set up and Tear down methods for testing methods in the Sniff.php file.
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 */
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