mageekguy\atoum\mock\generator::methodIsMockable PHP Méthode

methodIsMockable() public méthode

public methodIsMockable ( reflectionMethod $method )
$method reflectionMethod
    public function methodIsMockable(\reflectionMethod $method)
    {
        switch (true) {
            case $method->isFinal():
            case $method->isStatic():
            case static::methodNameIsReservedWord($method):
                return false;
            case $method->isPrivate():
            case $method->isProtected() && $method->isAbstract() === false:
                return $this->isOverloaded($method->getName());
            default:
                return true;
        }
    }

Usage Example

Exemple #1
0
 /** @php >= 7.0 */
 public function testMethodIsMockableWithReservedWordPhp7($reservedWord)
 {
     $this->if($generator = new testedClass())->and($this->mockGenerator->orphanize('__construct'))->and($method = new \mock\reflectionMethod($this, $reservedWord))->and($this->calling($method)->getName = $reservedWord)->and($this->calling($method)->isFinal = false)->and($this->calling($method)->isStatic = false)->and($this->calling($method)->isAbstract = false)->and($this->calling($method)->isPrivate = false)->and($this->calling($method)->isProtected = false)->then->boolean($generator->methodIsMockable($method))->isFalse();
 }