コード例 #1
0
ファイル: TestCase.php プロジェクト: nicolas-grekas/phpunit
 /**
  * @param array $testArguments
  *
  * @since Method available since Release 5.0.0
  */
 private function registerMockObjectsFromTestArguments(array $testArguments)
 {
     if ($this->registerMockObjectsFromTestArgumentsRecursively) {
         $enumerator = new Enumerator();
         foreach ($enumerator->enumerate($testArguments) as $object) {
             if ($object instanceof PHPUnit_Framework_MockObject_MockObject) {
                 $this->registerMockObject($object);
             }
         }
     } else {
         foreach ($testArguments as $testArgument) {
             if ($testArgument instanceof PHPUnit_Framework_MockObject_MockObject) {
                 $this->registerMockObject($testArgument);
             } elseif (is_array($testArgument)) {
                 $this->registerMockObjectsFromTestArguments($testArgument);
             }
         }
     }
 }
コード例 #2
0
ファイル: TestCase.php プロジェクト: sungvadan/phpunit
 /**
  * @param array $testArguments
  *
  * @since Method available since Release 5.0.0
  */
 private function registerMockObjectsFromTestArguments(array $testArguments)
 {
     $enumerator = new Enumerator();
     foreach ($enumerator->enumerate($testArguments) as $object) {
         if ($object instanceof PHPUnit_Framework_MockObject_MockObject) {
             $this->mockObjects[] = $object;
         }
     }
 }
コード例 #3
0
 /**
  * @param PHPUnit_Framework_MockObject_MockObject $mock
  *
  * @return bool
  *
  * @since  Method available since Release 5.0.0
  */
 private function shouldInvocationMockerBeReset(PHPUnit_Framework_MockObject_MockObject $mock)
 {
     $enumerator = new Enumerator();
     foreach ($enumerator->enumerate($this->dependencyInput) as $object) {
         if ($mock === $object) {
             return false;
         }
     }
     if (!is_array($this->testResult) && !is_object($this->testResult)) {
         return true;
     }
     foreach ($enumerator->enumerate($this->testResult) as $object) {
         if ($mock === $object) {
             return false;
         }
     }
     return true;
 }