3
* Gitblame report mock class.
8
* @package PHP_CodeSniffer
9
* @author Ben Selby <benmatselby@gmail.com>
10
* @copyright 2009 SQLI <www.sqli.com>
11
* @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
12
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
13
* @link http://pear.php.net/package/PHP_CodeSniffer
16
if (is_file(dirname(__FILE__).'/../../../../CodeSniffer.php') === true) {
17
// We are not installed.
18
include_once dirname(__FILE__).'/../../../../CodeSniffer/Report.php';
19
include_once dirname(__FILE__).'/../../../../CodeSniffer/Reports/VersionControl.php';
20
include_once dirname(__FILE__).'/../../../../CodeSniffer/Reports/Gitblame.php';
22
include_once 'PHP/CodeSniffer/Report.php';
23
include_once 'PHP/CodeSniffer/Reports/VersionControl.php';
24
include_once 'PHP/CodeSniffer/Reports/Gitblame.php';
28
* Gitblame report mock class.
31
* @package PHP_CodeSniffer
32
* @author Ben Selby <benmatselby@gmail.com>
33
* @copyright 2009 SQLI <www.sqli.com>
34
* @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
35
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
36
* @version Release: 1.3.4
37
* @link http://pear.php.net/package/PHP_CodeSniffer
39
class PHP_CodeSniffer_Reports_Mock_Gitblame extends PHP_CodeSniffer_Reports_Gitblame
43
* Example gitblame output.
47
protected $fooBlames = array(
48
'054e7580 (Ben Selby 1 2009-08-25 45) * @return',
49
'054e758a (Ben Selby 2 2009-08-25 45) * @return',
50
'054e758b (Ben Selby 3 2009-08-25 45) * @return',
51
'054e758c (Ben Selby 4 2009-08-25 45) * @return',
52
'054e758d (Ben Selby 5 2009-08-25 45) * @return',
53
'1ee0f411 (Ben Selby 6 2009-08-25 45) * @return',
54
'1ee0f41b (Ben Selby 7 2009-08-25 45) * @return',
55
'1ee0f41c (Ben Selby 8 2009-08-25 45) * @return',
56
'1ee0f41d (Ben Selby 9 2009-08-25 45) * @return',
57
'1ee0f41e (Ben Selby 10 2009-08-25 45) * @return',
61
* Example gitblame output.
65
protected $barBlames = array(
66
'054e7580 (Ben Selby 1 2009-08-25 45) * @return',
67
'054e758a (Ben Selby 2 2009-08-25 45) * @return',
68
'054e758b (Ben Selby 3 2009-08-25 45) * @return',
69
'054e758c (Ben Selby 4 2009-08-25 45) * @return',
70
'054e758d (Ben Selby 5 2009-08-25 45) * @return',
71
'1ee0f411 (Ben Selby 6 2009-08-25 45) * @return',
72
'1ee0f41b (Ben Selby 7 2009-08-25 45) * @return',
73
'1ee0f41c (Ben Selby 8 2009-08-25 45) * @return',
74
'1ee0f41d (Ben Selby 9 2009-08-25 45) * @return',
75
'1ee0f41e (Ben Selby 10 2009-08-25 45) * @return',
79
* Example gitblame output.
83
protected $bazBlames = array(
84
'054e7580 (Ben Selby 1 2009-08-25 45) * @return',
85
'054e758a (Ben Selby 2 2009-08-25 45) * @return',
86
'054e758b (Ben Selby 3 2009-08-25 45) * @return',
87
'054e758c (Ben Selby 4 2009-08-25 45) * @return',
88
'054e758d (Ben Selby 5 2009-08-25 45) * @return',
89
'1ee0f411 (Ben Selby 6 2009-08-25 45) * @return',
90
'1ee0f41b (Ben Selby 7 2009-08-25 45) * @return',
91
'1ee0f41c (Ben Selby 8 2009-08-25 45) * @return',
92
'1ee0f41d (Ben Selby 9 2009-08-25 45) * @return',
93
'1ee0f41e (Ben Selby 10 2009-08-25 45) * @return',
97
* Example gitblame output with long revision numbers.
101
protected $bigRevisionNumberBlames = array(
102
'054e7580 (Ben Selby 1 2009-08-25 45) * @return',
103
'054e758a (Ben Selby 2 2009-08-25 45) * @return',
104
'054e758b (Ben Selby 3 2009-08-25 45) * @return',
105
'054e758c (Ben Selby 4 2009-08-25 45) * @return',
106
'054e758d (Ben Selby 5 2009-08-25 45) * @return',
107
'1ee0f411 (Ben Selby 6 2009-08-25 45) * @return',
108
'1ee0f41b (Ben Selby 7 2009-08-25 45) * @return',
109
'1ee0f41c (Ben Selby 8 2009-08-25 45) * @return',
110
'1ee0f41d (Ben Selby 9 2009-08-25 45) * @return',
111
'1ee0f41e (Ben Selby 10 2009-08-25 45) * @return',
116
* Mocks the gitblame command.
118
* @param string $filename filename (equals fixtures keys).
121
* @throws PHP_CodeSniffer_Exception
123
protected function getBlameContent($filename)
127
$blames = $this->fooBlames;
130
$blames = $this->barBlames;
133
$blames = $this->bazBlames;
135
case 'bigRevisionNumber':
136
$blames = $this->bigRevisionNumberBlames;
139
throw new PHP_CodeSniffer_Exception('Unexpected filename '.$filename);
144
}//end getGitblameContent()
148
* Needed to test protected method.
150
* @param string $line Line to parse.
154
public function testGetGitAuthor($line)
156
return $this->getAuthor($line);
158
}//end testGetGitAuthor()