예제 #1
0
 /**
  * @param MethodCollection $base
  * @param MethodCollection $challenger
  */
 public function compare(MethodCollection $base, MethodCollection $challenger)
 {
     foreach ($base as $baseMethod) {
         /* @var $baseMethod \RenanBr\PhpAct\Project\Method */
         $name = $baseMethod->getName();
         if (!$challenger->has($name) && !$this->mustSkip($baseMethod, null)) {
             $difference = new Difference('method has been removed');
             $this->populateDifference($difference, $baseMethod);
             if ('private' !== $baseMethod->getVisibility()) {
                 $difference->addTag(Difference::BC_BREAK);
             }
             $this->differences->add($difference);
         }
     }
     $methodComparator = new MethodComparator();
     $methodComparator->setDifferences($this->differences);
     foreach ($challenger as $challengerMethod) {
         /* @var $challengerMethod \RenanBr\PhpAct\Project\Method */
         $name = $challengerMethod->getName();
         if ($base->has($name)) {
             $baseMethod = $base->get($name);
             if (!$this->mustSkip($baseMethod, $challengerMethod)) {
                 $methodComparator->compare($baseMethod, $challengerMethod);
             }
         } else {
             if (!$this->mustSkip(null, $challengerMethod)) {
                 $difference = new Difference('method has been added');
                 $this->populateDifference($difference, $challengerMethod);
                 $this->differences->add($difference);
             }
         }
     }
 }
예제 #2
0
 /**
  * @dataProvider returnTypeProvider
  */
 public function testReturnType($expected, $name)
 {
     self::assertEquals($expected, self::$methods->get($name)->getReturnType());
 }