TestCaseTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 31
ccs 4
cts 4
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
getName() 0 1 ?
A getTest() 0 4 1
A getMocks() 0 4 1
1
<?php
2
namespace Pumpkin\Test;
3
4
/**
5
 * Class TestCase
6
 * @package Pumpkin\Test
7
 * @author Raphaël Lefebvre <[email protected]>
8
 */
9
trait TestCaseTrait
10
{
11
    /**
12
     * Returns the name of the current test method.
13
     *
14
     * @param bool $withDataSet
15
     * @return string
16
     */
17
    abstract function getName($withDataSet = true);
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
19
    /**
20
     * Returns the current test.
21
     *
22
     * @return Test
23
     */
24 6
    protected function getTest()
25
    {
26 6
        return new Test(new \ReflectionMethod($this, $this->getName(false)));
27
    }
28
29
    /**
30
     * Returns the mocks associated with the current test.
31
     *
32
     * @param array $constructorArgs
33
     * @return object[]
34
     */
35 2
    protected function getMocks(array $constructorArgs = array())
36
    {
37 2
        return $this->getTest()->getMocks($constructorArgs);
38
    }
39
}
40