88% of 138OPs |
83% of 23Lines |
61% of 18Branches |
47% of 17Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\tools\diffs\variable::__construct() | 18 | 100% | 3 | 100% | 1 | 0% | 1 | 100% |
mageekguy\atoum\tools\diffs\variable::setAnalyzer() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\tools\diffs\variable::getAnalyzer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\tools\diffs\variable::setExpected() | 18 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\tools\diffs\variable::setActual() | 18 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\tools\diffs\variable::make() | 62 | 74% | 15 | 73% | 13 | 54% | 12 | 25% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\tools\diffs; |
4 |
|
5 |
use |
6 |
mageekguy\atoum\tools, |
7 |
mageekguy\atoum\exceptions |
8 |
; |
9 |
|
10 |
class variable extends tools\diff |
11 |
{ |
12 |
protected $analyzer = null; |
13 |
|
14 |
public function __construct($expected = null, $actual = null)100% |
15 |
{ |
16 |
$this->setAnalyzer(); |
17 |
|
18 |
parent::__construct($expected, $actual); |
19 |
} |
20 |
|
21 |
public function setAnalyzer(tools\variable\analyzer $analyzer = null)100% |
22 |
{ |
23 |
$this->analyzer = $analyzer ?: new tools\variable\analyzer(); |
24 |
|
25 |
return $this; |
26 |
} |
27 |
|
28 |
public function getAnalyzer()100% |
29 |
{ |
30 |
return $this->analyzer; |
31 |
} |
32 |
|
33 |
public function setExpected($mixed)100% |
34 |
{ |
35 |
return parent::setExpected($this->analyzer->dump($mixed)); |
36 |
} |
37 |
|
38 |
public function setActual($mixed)100% |
39 |
{ |
40 |
return parent::setActual($this->analyzer->dump($mixed)); |
41 |
} |
42 |
|
43 |
public function make($expected = null, $actual = null)73% |
44 |
{ |
45 |
if ($expected !== null) |
46 |
{ |
47 |
$this->setExpected($expected); |
48 |
} |
49 |
|
50 |
if ($expected !== null) |
51 |
{ |
52 |
$this->setActual($actual); |
53 |
} |
54 |
|
55 |
if ($this->expected === null) |
56 |
{ |
57 |
throw new exceptions\runtime('Expected is undefined'); |
58 |
} |
59 |
|
60 |
if ($this->actual === null) |
61 |
{ |
62 |
throw new exceptions\runtime('Actual is undefined'); |
63 |
} |
64 |
|
65 |
return parent::make(); |
66 |
} |
67 |
} |