Failed Conditions
Pull Request — master (#87)
by
unknown
03:10
created

SkippingUnsupportedTestCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 4
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A onNotSuccessfulTest() 0 8 2
1
<?php
2
3
namespace aik099\PHPUnit;
0 ignored issues
show
introduced by
Expected 2 blank line(-s) after namespace declaration; 1 found
Loading history...
4
5
use Behat\Mink\Exception\UnsupportedDriverActionException;
6
7
if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) {
0 ignored issues
show
introduced by
Expected 1 spaces after "if" opening bracket; 0 found
Loading history...
introduced by
Expected 1 spaces before "if" closing bracket; 0 found
Loading history...
8
    /**
9
     * Implementation of the skipping for UnsupportedDriverActionException for PHPUnit 5+
10
     *
11
     * This code should be moved back to \aik099\BrowserTestCase when dropping support for
12
     * PHP 5.5 and older, as PHPUnit 4 won't be needed anymore.
13
     *
14
     * Class SkippingUnsupportedTestCase
15
     *
16
     * @internal
17
     *
18
     * @package aik099\PHPUnit
19
     */
20
    class SkippingUnsupportedTestCase extends \PHPUnit_Framework_TestCase
0 ignored issues
show
introduced by
Expected 0 spaces before class keyword; 4 found
Loading history...
21
    {
22
        /**
23
         * This method is called when a test method did not execute successfully.
24
         *
25
         * @param \Exception|\Throwable $e
0 ignored issues
show
introduced by
Missing parameter comment
Loading history...
26
         *
27
         * @return void
28
         */
29
        protected function onNotSuccessfulTest($e)
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before function; 0 found
Loading history...
30
        {
31
            if ($e instanceof UnsupportedDriverActionException) {
0 ignored issues
show
introduced by
Expected 1 spaces after "if" opening bracket; 0 found
Loading history...
introduced by
Expected 1 spaces before "if" closing bracket; 0 found
Loading history...
32
                $this->markTestSkipped($e->getMessage());
33
            }
34
35
            parent::onNotSuccessfulTest($e);
36
        }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
37
    }
0 ignored issues
show
introduced by
Expected 0 spaces before closing brace; 4 found
Loading history...
introduced by
Closing brace of a class must be followed by a single blank line; found 0
Loading history...
38
} else {
0 ignored issues
show
introduced by
Beginning of the "else" control structure must be first content on the line
Loading history...
introduced by
Expected "}\nelse \n"; found " else {\n"
Loading history...
39
    /**
40
     * Class SkippingUnsupportedTestCase
41
     *
42
     * Implementation of the skipping for UnsupportedDriverActionException for PHPUnit 4
43
     *
44
     * @internal
45
     *
46
     * @package aik099\PHPUnit
47
     */
48
    class SkippingUnsupportedTestCase extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type aik099\PHPUnit\SkippingUnsupportedTestCase has been defined more than once; this definition is ignored, only the first definition in this file (L20-37) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
Coding Style introduced by
Only one class is allowed in a file
Loading history...
introduced by
Expected 0 spaces before class keyword; 4 found
Loading history...
49
    {
50
        /**
51
         * This method is called when a test method did not execute successfully.
52
         *
53
         * @param \Exception $e Exception.
54
         *
55
         * @return void
56
         */
57
        protected function onNotSuccessfulTest(\Exception $e)
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before function; 0 found
Loading history...
58
        {
59
            if ($e instanceof UnsupportedDriverActionException) {
0 ignored issues
show
introduced by
Expected 1 spaces after "if" opening bracket; 0 found
Loading history...
introduced by
Expected 1 spaces before "if" closing bracket; 0 found
Loading history...
60
                $this->markTestSkipped($e->getMessage());
61
            }
62
63
            parent::onNotSuccessfulTest($e);
64
        }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
65
    }
0 ignored issues
show
introduced by
Expected 0 spaces before closing brace; 4 found
Loading history...
introduced by
Closing brace of a class must be followed by a single blank line; found 0
Loading history...
66
}
67