86% of 123OPs |
81% of 16Lines |
63% of 16Branches |
71% of 7Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\asserters\boolean::__get() | 39 | 56% | 7 | 57% | 9 | 44% | 3 | 67% |
mageekguy\atoum\asserters\boolean::setWith() | 42 | 100% | 7 | 100% | 5 | 80% | 2 | 50% |
mageekguy\atoum\asserters\boolean::isTrue() | 21 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\asserters\boolean::isFalse() | 21 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\asserters; |
4 |
|
5 |
use |
6 |
mageekguy\atoum\asserters, |
7 |
mageekguy\atoum\exceptions |
8 |
; |
9 |
|
10 |
class boolean extends asserters\variable |
11 |
{ |
12 |
public function __get($property)57% |
13 |
{ |
14 |
switch (strtolower($property)) |
15 |
{ |
16 |
case 'isfalse': |
17 |
case 'istrue': |
18 |
return $this->{$property}(); |
19 |
|
20 |
default: |
21 |
return parent::__get($property); |
22 |
} |
23 |
} |
24 |
|
25 |
public function setWith($value)100% |
26 |
{ |
27 |
parent::setWith($value); |
28 |
|
29 |
if ($this->analyzer->isBoolean($this->value) === true) |
30 |
{ |
31 |
$this->pass(); |
32 |
} |
33 |
else |
34 |
{ |
35 |
$this->fail($this->_('%s is not a boolean', $this)); |
36 |
} |
37 |
|
38 |
return $this; |
39 |
} |
40 |
|
41 |
public function isTrue($failMessage = null)100% |
42 |
{ |
43 |
return $this->isEqualTo(true, $failMessage ?: $this->_('%s is not true', $this)); |
44 |
} |
45 |
|
46 |
public function isFalse($failMessage = null)100% |
47 |
{ |
48 |
return $this->isEqualTo(false, $failMessage ?: $this->_('%s is not false', $this)); |
49 |
} |
50 |
} |