94% of 201OPs |
93% of 29Lines |
76% of 25Branches |
93% of 15Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\asserters\phpFunction::setWithTest() | 31 | 100% | 7 | 100% | 4 | 100% | 2 | 100% |
| mageekguy\atoum\asserters\phpFunction::setWith() | 22 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\phpFunction::wasCalled() | 9 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\phpFunction::wasCalledWithArguments() | 14 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\phpFunction::wasCalledWithIdenticalArguments() | 14 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\phpFunction::wasCalledWithAnyArguments() | 9 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\phpFunction::wasCalledWithoutAnyArgument() | 11 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\phpFunction::setFunction() | 49 | 100% | 10 | 100% | 7 | 100% | 3 | 100% |
| mageekguy\atoum\asserters\phpFunction::adapterIsSet() | 21 | 95% | 3 | 100% | 4 | 50% | 2 | 100% |
| mageekguy\atoum\asserters\phpFunction::callIsSet() | 21 | 43% | 3 | 33% | 4 | 0% | 2 | 50% |
| # | |
|---|---|
| 1 |
<?php |
| 2 |
|
| 3 |
namespace mageekguy\atoum\asserters; |
| 4 |
|
| 5 |
use |
| 6 |
mageekguy\atoum, |
| 7 |
mageekguy\atoum\php, |
| 8 |
mageekguy\atoum\test, |
| 9 |
mageekguy\atoum\exceptions, |
| 10 |
mageekguy\atoum\asserters\adapter\call |
| 11 |
; |
| 12 |
|
| 13 |
class phpFunction extends atoum\asserters\adapter\call |
| 14 |
{
|
| 15 |
public function setWithTest(atoum\test $test)100% |
| 16 |
{
|
| 17 |
parent::setWithTest($test); |
| 18 |
|
| 19 |
$function = $this->call->getFunction(); |
| 20 |
|
| 21 |
if ($function !== null) |
| 22 |
{
|
| 23 |
$this->setWith($function); |
| 24 |
} |
| 25 |
|
| 26 |
return $this; |
| 27 |
} |
| 28 |
|
| 29 |
public function setWith($function)100% |
| 30 |
{
|
| 31 |
return parent::setWith(clone php\mocker::getAdapter())->setFunction($function); |
| 32 |
} |
| 33 |
|
| 34 |
public function wasCalled()100% |
| 35 |
{
|
| 36 |
return $this->unsetArguments(); |
| 37 |
} |
| 38 |
|
| 39 |
public function wasCalledWithArguments()100% |
| 40 |
{
|
| 41 |
return $this->setArguments(func_get_args()); |
| 42 |
} |
| 43 |
|
| 44 |
public function wasCalledWithIdenticalArguments()100% |
| 45 |
{
|
| 46 |
return $this->setIdenticalArguments(func_get_args()); |
| 47 |
} |
| 48 |
|
| 49 |
public function wasCalledWithAnyArguments()100% |
| 50 |
{
|
| 51 |
return $this->unsetArguments(); |
| 52 |
} |
| 53 |
|
| 54 |
public function wasCalledWithoutAnyArgument()100% |
| 55 |
{
|
| 56 |
return $this->setArguments(array()); |
| 57 |
} |
| 58 |
|
| 59 |
protected function setFunction($function)100% |
| 60 |
{
|
| 61 |
if ($this->test !== null) |
| 62 |
{
|
| 63 |
$lastNamespaceSeparator = strrpos($function, '\\'); |
| 64 |
|
| 65 |
if ($lastNamespaceSeparator !== false) |
| 66 |
{
|
| 67 |
$function = substr($function, $lastNamespaceSeparator + 1); |
| 68 |
} |
| 69 |
|
| 70 |
$function = $this->test->getTestedClassNamespace() . '\\' . $function; |
| 71 |
} |
| 72 |
|
| 73 |
return parent::setFunction($function); |
| 74 |
} |
| 75 |
|
| 76 |
protected function adapterIsSet()100% |
| 77 |
{
|
| 78 |
try |
| 79 |
{
|
| 80 |
return parent::adapterIsSet(); |
| 81 |
} |
| 82 |
catch (call\exceptions\logic $exception) |
| 83 |
{
|
| 84 |
throw new exceptions\logic('Function is undefined');
|
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
protected function callIsSet()33% |
| 89 |
{
|
| 90 |
try |
| 91 |
{
|
| 92 |
return parent::callIsSet(); |
| 93 |
} |
| 94 |
catch (call\exceptions\logic $exception) |
| 95 |
{
|
| 96 |
throw new exceptions\logic('Call is undefined');
|
| 97 |
} |
| 98 |
} |
| 99 |
} |