Пример #1
0
 private function executeMethodLogs($methodLogs, $testedFunctionDescriptions)
 {
     if ($methodLogs) {
         $this->adviceManager->startListener();
         foreach ($methodLogs as $methodLog) {
             $functionDescription = new FunctionDescription();
             $functionDescription->setSignature($methodLog->functionSignature);
             if ($functionDescription->isStatic()) {
                 $output = call_user_func($functionDescription->className . '::' . $functionDescription->methodName);
             } else {
                 $testObj = $this->createTestObject($functionDescription->className, $testedFunctionDescriptions);
                 $output = call_user_func_array(array($testObj, $functionDescription->methodName), $methodLog->data);
             }
             $failures = MethodsAdvice::getFailures();
             if (!empty($failures)) {
                 MethodsAdvice::tearDown();
                 $this->fail(implode($failures, PHP_EOL));
             }
             $this->assertEquals($methodLog->getReturnLog()->data, $output);
         }
         $this->adviceManager->stopListener();
         MethodsAdvice::tearDown();
     } else {
         throw new Exception('No method in logs to unit test found. ' . 'This is considered a bug in the Unit testing framework');
     }
 }
Пример #2
0
 public function removeIgnoredFunctions($functionSignatures)
 {
     $ignoredCalls = MethodsAdvice::getIgnoreCalls();
     for ($i = 0; $i < count($ignoredCalls); $i++) {
         if (in_array($ignoredCalls[$i], $functionSignatures)) {
             unset($ignoredCalls[$i]);
         }
     }
     MethodsAdvice::setIgnoreCalls($ignoredCalls);
 }