98% of 120OPs |
100% of 15Lines |
82% of 17Branches |
100% of 11Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\report\fields\runner\result\notifier\image::__toString() | 21 | 95% | 3 | 100% | 4 | 50% | 2 | 100% |
mageekguy\atoum\report\fields\runner\result\notifier\image::setSuccessImage() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\result\notifier\image::getSuccessImage() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\result\notifier\image::setFailureImage() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\result\notifier\image::getFailureImage() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\result\notifier\image::getImage() | 48 | 98% | 5 | 100% | 8 | 88% | 4 | 100% |
mageekguy\atoum\report\fields\runner\result\notifier\image::send() | 21 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\report\fields\runner\result\notifier; |
4 |
|
5 |
use |
6 |
mageekguy\atoum, |
7 |
mageekguy\atoum\exceptions, |
8 |
mageekguy\atoum\report\fields\runner\result\notifier |
9 |
; |
10 |
|
11 |
abstract class image extends notifier |
12 |
{ |
13 |
protected $directory = null; |
14 |
protected $successImage = null; |
15 |
protected $failureImage = null; |
16 |
|
17 |
public function __toString()100% |
18 |
{ |
19 |
try |
20 |
{ |
21 |
return parent::__toString(); |
22 |
} |
23 |
catch (exceptions\runtime $exception) |
24 |
{ |
25 |
return $exception->getMessage() . PHP_EOL; |
26 |
} |
27 |
} |
28 |
|
29 |
public function setSuccessImage($path)100% |
30 |
{ |
31 |
$this->successImage = $path; |
32 |
|
33 |
return $this; |
34 |
} |
35 |
|
36 |
public function getSuccessImage()100% |
37 |
{ |
38 |
return $this->successImage; |
39 |
} |
40 |
|
41 |
public function setFailureImage($path)100% |
42 |
{ |
43 |
$this->failureImage = $path; |
44 |
|
45 |
return $this; |
46 |
} |
47 |
|
48 |
public function getFailureImage()100% |
49 |
{ |
50 |
return $this->failureImage; |
51 |
} |
52 |
|
53 |
public function getImage($success)100% |
54 |
{ |
55 |
$image = $success ? $this->getSuccessImage() : $this->getFailureImage(); |
56 |
|
57 |
if ($this->getAdapter()->file_exists($image) === false) |
58 |
{ |
59 |
throw new exceptions\runtime(sprintf('File %s does not exist', $image)); |
60 |
} |
61 |
|
62 |
return $image; |
63 |
} |
64 |
|
65 |
public function send($title, $message, $success)100% |
66 |
{ |
67 |
return parent::send($title, $message, $this->getImage($success)); |
68 |
} |
69 |
} |