mageekguy\atoum\reports\asynchronous: lines coverage

86% of 166

OPs

92% of 24

Lines

75% of 36

Branches

18% of 55

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\reports\asynchronous::__toString() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\reports\asynchronous::handleEvent() 131 89% 18 94% 28 82% 50 14%
mageekguy\atoum\reports\asynchronous::addWriter() 11 100% 1 100% 1 100% 1 100%
mageekguy\atoum\reports\asynchronous::build() 18 56% 4 75% 6 33% 3 33%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\reports;
4

                    
5
use
6
	mageekguy\atoum,
7
	mageekguy\atoum\report
8
;
9

                    
10
abstract class asynchronous extends atoum\report
11
{
12
	protected $string = '';
13
	protected $fail = false;
14

                    
15
	public function __toString()100%
16
	{
17
		return $this->string;
18
	}
19

                    
20
	public function handleEvent($event, atoum\observable $observable)94%
21
	{
22
		switch ($event)
23
		{
24
			case atoum\test::fail:
25
			case atoum\test::error:
26
			case atoum\test::exception:
27
			case atoum\test::uncompleted:
28
				$this->fail = true;
29
				break;
30
		}
31

                    
32
		parent::handleEvent($event, $observable)->build($event);
33

                    
34
		if ($event === atoum\runner::runStop)
35
		{
36
			if ($this->title !== null)
37
			{
38
				$this->title = sprintf($this->title, $this->adapter->date($this->locale->_('Y-m-d')), $this->adapter->date($this->locale->_('H:i:s')), $this->fail === true ? $this->locale->_('FAIL') : $this->locale->_('SUCCESS'));
39
			}
40

                    
41
			foreach ($this->writers as $writer)
42
			{
43
				$writer->writeAsynchronousReport($this)->reset();
44
			}
45
		}
46

                    
47
		return $this;
48
	}
49

                    
50
	public function addWriter(report\writers\asynchronous $writer)100%
51
	{
52
		return $this->doAddWriter($writer);
53
	}
54

                    
55
	protected function build($event)75%
56
	{
57
		foreach ($this->lastSetFields as $field)
58
		{
59
			$this->string .= (string) $field;
60
		}
61

                    
62
		return $this;
63
	}
64
}