Exemplo n.º 1
0
 public function __construct(atoum\adapter $adapter = null)
 {
     if ($adapter === null) {
         $adapter = new atoum\adapter();
     }
     if (self::$isTerminal === null) {
         self::$isTerminal = $adapter->defined('PHP_WINDOWS_VERSION_BUILD') ? (bool) $adapter->getenv('ANSICON') : $adapter->defined('STDOUT') === true && $adapter->function_exists('posix_isatty') === true && $adapter->posix_isatty($adapter->constant('STDOUT')) === true;
     }
 }
Exemplo n.º 2
0
 public function invoke($functionName, array $arguments = array())
 {
     if (self::isLanguageConstruct($functionName) || function_exists($functionName) === true && is_callable($functionName) === false) {
         throw new exceptions\logic\invalidArgument('Function \'' . $functionName . '()\' is not invokable by an adapter');
     }
     $call = sizeof($this->addCall($functionName, $arguments)->getCallsEqualTo(new adapter\call($functionName)));
     try {
         return $this->callIsOverloaded($functionName, $call) === false ? parent::invoke($functionName, $arguments) : $this->{$functionName}->invoke($arguments, $call);
     } catch (exceptions\logic\invalidArgument $exception) {
         throw new exceptions\logic('There is no return value defined for \'' . $functionName . '() at call ' . $call);
     }
 }
Exemplo n.º 3
0
 public function testInvoke()
 {
     $this->given($adapter = new testedClass())->then->string($adapter->invoke('md5', array($hash = uniqid())))->isEqualTo(md5($hash));
 }
Exemplo n.º 4
0
 public function test__call()
 {
     $this->if($adapter = new atoum\adapter())->then->string($adapter->md5($hash = uniqid()))->isEqualTo(md5($hash));
 }