Esempio 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;
     }
 }
 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);
     }
 }
Esempio n. 3
0
 public function testInvoke()
 {
     $this->given($adapter = new testedClass())->then->string($adapter->invoke('md5', array($hash = uniqid())))->isEqualTo(md5($hash));
 }
Esempio n. 4
0
 public function test__call()
 {
     $this->if($adapter = new atoum\adapter())->then->string($adapter->md5($hash = uniqid()))->isEqualTo(md5($hash));
 }