コード例 #1
0
 /**
  * Return statements for invoking the test.
  *
  * @param bool   $shouldVerifyResult
  * @param string $argumentsString
  * @param string $targetObjectName
  *
  * @return string
  */
 public function genExecutionStatements($shouldVerifyResult, $argumentsString, $targetObjectName)
 {
     if ($shouldVerifyResult) {
         // The space character has to be included here
         // instead of the place where string concatenation happens
         // because when the string is empty, we don't want to
         // include an extra space character.
         $assignmentStr = '$executionResult = ';
     } else {
         // If the return value type of the method under test is void
         // don't assign the return value to a local variable.
         // Otherwise intellij will warn you about using such a value.
         $assignmentStr = '';
     }
     $isPublic = $this->globalComputedConfig->isMethodPublic();
     $isStatic = $this->globalComputedConfig->isMethodStatic();
     $fullClassName = $this->globalComputedConfig->getFullClassName();
     $methodName = $this->globalComputedConfig->getMethodName();
     if ($isPublic) {
         if ($isStatic) {
             $invocationStatement = "{$assignmentStr}{$fullClassName}::{$methodName}({$argumentsString});";
         } else {
             $invocationStatement = "{$assignmentStr}\${$targetObjectName}->{$methodName}({$argumentsString});";
         }
     } else {
         $invocationStatement = $this->nonPublicMethodExecutionRenderer->genNonPublicExecutionStatements($assignmentStr, $isStatic, $fullClassName, $methodName, $argumentsString, $targetObjectName);
     }
     return $invocationStatement;
 }
コード例 #2
0
ファイル: Executor.php プロジェクト: jamescaldwell/TestScribe
 /**
  * @return \Box\TestScribe\Execution\ExecutionResult
  * @throws \Box\TestScribe\Exception\AbortException
  * @throws \Box\TestScribe\Exception\TestScribeException
  */
 public function runMethod()
 {
     $isStatic = $this->globalComputedConfig->isMethodStatic();
     if ($isStatic) {
         $executionResult = $this->staticMethodExecutor->runStaticMethod();
     } else {
         $executionResult = $this->instanceMethodExecutor->runInstanceMethod();
     }
     return $executionResult;
 }