コード例 #1
0
ファイル: Arithmetic.php プロジェクト: dantleech/Math
 /**
  * Add a function.
  *
  * @param   string  $name        Function name.
  * @param   mixed   $callable    Callable.
  * @return  void
  */
 public function addFunction($name, $callable = null)
 {
     return $this->_context->addFunction($name, $callable);
 }
コード例 #2
0
ファイル: Context.php プロジェクト: mgratch/Math
 public function case_context_returns_the_right_function_callable()
 {
     $this->given($name = 'foo', $value = 42, $callable = function () use($value) {
         return $value;
     }, $context = new CUT(), $context->addFunction($name, $callable))->when($result = $context->getFunction($name))->then->integer($result())->isEqualTo($value);
 }