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

SkippingUnsupportedTestCase::onNotSuccessfulTest()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 2
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
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 \Behat\Mink\Tests\Driver\TestCase when dropping support for
12
     * PHP 5.5 and older, as PHPUnit 4 won't be needed anymore.
13
     *
14
     * @internal
15
     */
16
    class SkippingUnsupportedTestCase extends \PHPUnit_Framework_TestCase
0 ignored issues
show
introduced by
Expected 0 spaces before class keyword; 4 found
Loading history...
17
    {
18
        protected function onNotSuccessfulTest($e)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
Coding Style introduced by
Expected 1 blank line before function; 0 found
Loading history...
19
        {
20
            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...
21
                $this->markTestSkipped($e->getMessage());
22
            }
23
24
            parent::onNotSuccessfulTest($e);
25
        }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
26
    }
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...
27
} else {
0 ignored issues
show
introduced by
Expected "}\nelse \n"; found " else {\n"
Loading history...
introduced by
Beginning of the "else" control structure must be first content on the line
Loading history...
28
    /**
29
     * Implementation of the skipping for UnsupportedDriverActionException for PHPUnit 4
30
     *
31
     * @internal
32
     */
33
    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 (L16-26) 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...
34
    {
35
        protected function onNotSuccessfulTest(\Exception $e)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
Coding Style introduced by
Expected 1 blank line before function; 0 found
Loading history...
36
        {
37
            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...
38
                $this->markTestSkipped($e->getMessage());
39
            }
40
41
            parent::onNotSuccessfulTest($e);
42
        }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
43
    }
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...
44
}
45