Пример #1
0
 protected function renderArguments(array $args = null)
 {
     if (null === $args) {
         return '';
     }
     $valueRenderer = new ValueRenderer();
     return $valueRenderer->renderAll($args);
 }
Пример #2
0
 public function testRenderAllWithStrings()
 {
     $this->assert($this->renderer->renderAll(array('foo')))->equals('"foo"');
 }
Пример #3
0
 /**
  * Expected arguments when invoking the mock.
  *
  * @throws \Exception
  * @return MockBuilder
  */
 public function with()
 {
     $methodArguments = new MethodArguments();
     $this->currentWith = $methodArguments->getMethodArgumentValues(func_get_args(), $this->getClassName() . "::" . $this->currentRules[0]);
     foreach ($this->currentRules as $rule) {
         if ($this->rules[$rule][md5('null')]['hasSetTimes']) {
             $renderer = new ValueRenderer();
             $converter = new NumberToTimesConverter();
             $args = $renderer->renderAll($this->currentWith);
             $times = $this->rules[$rule][md5('null')]['times'];
             $convertToMethod = $converter->convertToMethod($times);
             throw new Exception(sprintf("%s:\n  ->expects('%s')->with(%s)->%s", "When using with you must specify expectations for each with()", $rule, $args, $convertToMethod));
         }
         $this->rules[$rule][md5('null')]['times'] = -1;
     }
     $this->setupWith(new Action\ReturnValueAction(array(null)), $this->isExpecting ? 1 : -1);
     return $this;
 }