Passed
Push — master ( 2927c7...98f658 )
by Michael
01:46
created

MultiLineArrayUnitTest::getErrorList()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 13

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 13
nc 3
nop 1
dl 18
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the mo4-coding-standard (phpcs standard)
5
 *
6
 * PHP version 5
7
 *
8
 * @category PHP
9
 * @package  PHP_CodeSniffer-MO4
10
 * @author   Xaver Loppenstedt <[email protected]>
11
 * @license  http://spdx.org/licenses/MIT MIT License
12
 * @version  GIT: master
13
 * @link     https://github.com/Mayflower/mo4-coding-standard
14
 */
15
16
namespace MO4\Tests\Arrays;
17
18
use PHP_CodeSniffer\Exceptions\RuntimeException;
19
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
0 ignored issues
show
Bug introduced by
The type PHP_CodeSniffer\Tests\St...s\AbstractSniffUnitTest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
21
/**
22
 * Unit test class for @see MultiLineArraySniff
23
 *
24
 * A sniff unit test checks a .inc file for expected violations of a single
25
 * coding standard. Expected errors and warnings are stored in this class.
26
 *
27
 * @category  PHP
28
 * @package   PHP_CodeSniffer-MO4
29
 * @author    Xaver Loppenstedt <[email protected]>
30
 * @copyright 2013-2017 Xaver Loppenstedt, some rights reserved.
31
 * @license   http://spdx.org/licenses/MIT MIT License
32
 * @link      https://github.com/Mayflower/mo4-coding-standard
33
 */
34 View Code Duplication
class MultiLineArrayUnitTest extends AbstractSniffUnitTest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
{
36
37
38
    /**
39
     * Returns the lines where errors should occur.
40
     *
41
     * The key of the array should represent the line number and the value
42
     * should represent the number of errors that should occur on that line.
43
     *
44
     * @param string $testFile test file
45
     *
46
     * @return array<int, int>
47
     * @throws RuntimeException
48
     */
49
    protected function getErrorList($testFile='')
50
    {
51
        switch ($testFile) {
52
        case 'MultiLineArrayUnitTest.pass.inc':
53
            return array();
54
        case 'MultiLineArrayUnitTest.fail.inc':
55
            return array(
56
                    4  => 1,
57
                    12 => 1,
58
                    18 => 2,
59
                    22 => 1,
60
                    24 => 1,
61
                    28 => 1,
62
                    32 => 1,
63
                   );
64
        }//end switch
65
66
        throw new RuntimeException("Testfile {$testFile} in ".__DIR__." is not handled by ".__CLASS__);
67
68
    }//end getErrorList()
69
70
71
    /**
72
     * Returns the lines where warnings should occur.
73
     *
74
     * The key of the array should represent the line number and the value
75
     * should represent the number of warnings that should occur on that line.
76
     *
77
     * @return array<int, int>
78
     */
79
    protected function getWarningList()
80
    {
81
        return array();
82
83
    }//end getWarningList()
84
85
86
}//end class
87