97% of 167OPs |
96% of 26Lines |
86% of 14Branches |
90% of 10Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\writers\mail::__construct() | 38 | 100% | 5 | 100% | 1 | 0% | 1 | 100% |
mageekguy\atoum\writers\mail::setMailer() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\writers\mail::getMailer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\writers\mail::setLocale() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\writers\mail::getLocale() | 6 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\writers\mail::clear() | 5 | 0% | 1 | 0% | 1 | 0% | 1 | 0% |
mageekguy\atoum\writers\mail::writeAsynchronousReport() | 81 | 100% | 11 | 100% | 7 | 100% | 3 | 100% |
mageekguy\atoum\writers\mail::doWrite() | 13 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\writers; |
4 |
|
5 |
use |
6 |
mageekguy\atoum, |
7 |
mageekguy\atoum\report, |
8 |
mageekguy\atoum\reports |
9 |
; |
10 |
|
11 |
class mail extends atoum\writer implements report\writers\asynchronous |
12 |
{ |
13 |
protected $mailer = null; |
14 |
protected $locale = null; |
15 |
|
16 |
public function __construct(atoum\mailer $mailer = null, atoum\locale $locale = null, atoum\adapter $adapter = null)100% |
17 |
{ |
18 |
parent::__construct($adapter); |
19 |
|
20 |
$this |
21 |
->setMailer($mailer ?: new atoum\mailers\mail()) |
22 |
->setLocale($locale ?: new atoum\locale()) |
23 |
; |
24 |
} |
25 |
|
26 |
public function setMailer(atoum\mailer $mailer)100% |
27 |
{ |
28 |
$this->mailer = $mailer; |
29 |
|
30 |
return $this; |
31 |
} |
32 |
|
33 |
public function getMailer()100% |
34 |
{ |
35 |
return $this->mailer; |
36 |
} |
37 |
|
38 |
public function setLocale(atoum\locale $locale)100% |
39 |
{ |
40 |
$this->locale = $locale; |
41 |
|
42 |
return $this; |
43 |
} |
44 |
|
45 |
public function getLocale()100% |
46 |
{ |
47 |
return $this->locale; |
48 |
} |
49 |
|
50 |
public function clear()0% |
51 |
{ |
52 |
return $this; |
53 |
} |
54 |
|
55 |
public function writeAsynchronousReport(reports\asynchronous $report)100% |
56 |
{ |
57 |
$mailerSubject = $this->mailer->getSubject(); |
58 |
|
59 |
if ($mailerSubject === null) |
60 |
{ |
61 |
$reportTitle = $report->getTitle(); |
62 |
|
63 |
if ($reportTitle === null) |
64 |
{ |
65 |
$reportTitle = sprintf($this->locale->_('Unit tests report, the %1$s at %2$s'), $this->adapter->date($this->locale->_('Y-m-d')), $this->adapter->date($this->locale->_('H:i:s'))); |
66 |
} |
67 |
|
68 |
$this->mailer->setSubject($reportTitle); |
69 |
} |
70 |
|
71 |
return $this->write((string) $report); |
72 |
} |
73 |
|
74 |
protected function doWrite($something)100% |
75 |
{ |
76 |
$this->mailer->send($something); |
77 |
|
78 |
return $this; |
79 |
} |
80 |
} |