mageekguy\atoum\scripts\runner::autorun PHP Method

autorun() public method

public autorun ( )
    public function autorun()
    {
        return isset($_SERVER['argv']) === false || isset($_SERVER['argv'][0]) === false || $this->adapter->realpath($_SERVER['argv'][0]) !== $this->getName();
    }

Usage Example

Esempio n. 1
0
 public function testAutorun()
 {
     $this->if($script = new testedClass(uniqid()))->and($script->setAdapter($adapter = new atoum\test\adapter()))->and($adapter->realpath = function ($path) {
         return $path;
     })->when(function () {
         if (isset($_SERVER['argv']) === true) {
             unset($_SERVER['argv']);
         }
     })->then->boolean($script->autorun())->isTrue()->if($_SERVER['argv'] = array())->then->boolean($script->autorun())->isTrue()->if($_SERVER['argv'][0] = $script->getName())->then->boolean($script->autorun())->isFalse()->if($adapter->realpath = uniqid())->then->boolean($script->autorun())->isTrue();
 }