Esempio n. 1
0
 /**
  * @param \PHPUnit_Framework_TestCase $testCase
  */
 private function setUpContext(\PHPUnit_Framework_TestCase $testCase)
 {
     $testMethodArguments = array();
     $reflectionMethod = new \ReflectionMethod($testCase, $testCase->getName(false));
     $annotationReader = AnnotationReaderFactory::getAnnotationReader();
     $annotations = $annotationReader->getMethodAnnotations($reflectionMethod);
     foreach ($annotations as $i => $annotation) {
         if ($annotation instanceof Arrange) {
             $arrangeOutput = $this->runAnnotations($testCase, $annotation, $i);
             if ($arrangeOutput !== null) {
                 $testMethodArguments[] = $arrangeOutput;
             }
         }
     }
     $testCase->setDependencyInput($testMethodArguments);
 }
 /**
  * @param \PHPUnit_Framework_TestCase $test
  * @return array
  */
 private function getArrangeLines(\PHPUnit_Framework_TestCase $test)
 {
     $arranges = [];
     $annotationReader = AnnotationReaderFactory::getAnnotationReader();
     foreach (ArrangeListener::$inputs[$test->getName(true)] as $i => $arrangeMethods) {
         foreach ($arrangeMethods as $arrangeMethod => $arguments) {
             try {
                 $describe = $this->getArrangeDescription($test, $annotationReader, $arrangeMethod);
                 $arranges[] = $this->getArrangeLine($describe, $arguments);
             } catch (\DomainException $ex) {
                 continue;
             }
         }
     }
     return $arranges;
 }