~ubuntu-branches/ubuntu/trusty/php-codesniffer/trusty

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.3.4/tests/Core/Reports/Mock/Gitblame.php

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2013-07-12 15:16:25 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130712151625-4autdc0twzbueha9
Tags: 1.5.0~rc2-1
* New upstream release.
* Refreshed patch.
* Standards-Version is now 3.9.4.
* Canonical VCS URLs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/**
3
 
 * Gitblame report mock class.
4
 
 *
5
 
 * PHP version 5
6
 
 *
7
 
 * @category  PHP
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
14
 
 */
15
 
 
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';
21
 
} else {
22
 
    include_once 'PHP/CodeSniffer/Report.php';
23
 
    include_once 'PHP/CodeSniffer/Reports/VersionControl.php';
24
 
    include_once 'PHP/CodeSniffer/Reports/Gitblame.php';
25
 
}
26
 
 
27
 
/**
28
 
 * Gitblame report mock class.
29
 
 *
30
 
 * @category  PHP
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
38
 
 */
39
 
class PHP_CodeSniffer_Reports_Mock_Gitblame extends PHP_CodeSniffer_Reports_Gitblame
40
 
{
41
 
 
42
 
    /**
43
 
     * Example gitblame output.
44
 
     *
45
 
     * @var array
46
 
     */
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',
58
 
    );
59
 
 
60
 
    /**
61
 
     * Example gitblame output.
62
 
     *
63
 
     * @var array
64
 
     */
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',
76
 
    );
77
 
 
78
 
    /**
79
 
     * Example gitblame output.
80
 
     *
81
 
     * @var array
82
 
     */
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',
94
 
    );
95
 
 
96
 
    /**
97
 
     * Example gitblame output with long revision numbers.
98
 
     *
99
 
     * @var array
100
 
     */
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',
112
 
    );
113
 
 
114
 
 
115
 
    /**
116
 
     * Mocks the gitblame command.
117
 
     *
118
 
     * @param string $filename filename (equals fixtures keys).
119
 
     *
120
 
     * @return string
121
 
     * @throws PHP_CodeSniffer_Exception
122
 
     */
123
 
    protected function getBlameContent($filename)
124
 
    {
125
 
        switch ($filename) {
126
 
        case 'foo':
127
 
            $blames = $this->fooBlames;
128
 
            break;
129
 
        case 'bar':
130
 
            $blames = $this->barBlames;
131
 
            break;
132
 
        case 'baz':
133
 
            $blames = $this->bazBlames;
134
 
            break;
135
 
        case 'bigRevisionNumber':
136
 
            $blames = $this->bigRevisionNumberBlames;
137
 
            break;
138
 
        default:
139
 
            throw new PHP_CodeSniffer_Exception('Unexpected filename '.$filename);
140
 
        }
141
 
 
142
 
        return $blames;
143
 
 
144
 
    }//end getGitblameContent()
145
 
 
146
 
 
147
 
    /**
148
 
     * Needed to test protected method.
149
 
     *
150
 
     * @param string $line Line to parse.
151
 
     *
152
 
     * @return string
153
 
     */
154
 
    public function testGetGitAuthor($line)
155
 
    {
156
 
        return $this->getAuthor($line);
157
 
 
158
 
    }//end testGetGitAuthor()
159
 
 
160
 
 
161
 
}//end class
162
 
 
163
 
?>