Автор: Markus Malkusch (markus@malkusch.de)
 /**
  * @SuppressWarnings(PHPMD)
  */
 public function reveal($value)
 {
     if (is_array($value)) {
         MockFunctionGenerator::removeDefaultArguments($value);
         foreach ($value as &$item) {
             $item = $this->revealer->reveal($item);
         }
         return $value;
     } else {
         return $this->revealer->reveal($value);
     }
 }
Пример #2
0
 /**
  * Defines the mocked function in the given namespace.
  *
  * In most cases you don't have to call this method. enable() is doing this
  * for you. But if the mock is defined after the first call in the
  * tested class, the tested class doesn't resolve to the mock. This is
  * documented in Bug #68541. You therefore have to define the namespaced
  * function before the first call. Defining the function has no side
  * effects as you still have to enable the mock. If the function was
  * already defined this method does nothing.
  *
  * @see enable()
  * @link https://bugs.php.net/bug.php?id=68541 Bug #68541
  */
 public function define()
 {
     $fqfn = $this->getFQFN();
     if (function_exists($fqfn)) {
         return;
     }
     $functionGenerator = new MockFunctionGenerator($this);
     $functionGenerator->defineFunction();
 }
 /**
  * @SuppressWarnings(PHPMD)
  */
 public function matches(\PHPUnit_Framework_MockObject_Invocation $invocation)
 {
     MockFunctionGenerator::removeDefaultArguments($invocation->parameters);
     return false;
 }