/**
  * @param MemberCollection $base
  * @param MemberCollection $challenger
  */
 public function compare(MemberCollection $base, MemberCollection $challenger)
 {
     foreach ($base as $baseMember) {
         /* @var $baseMember \RenanBr\PhpAct\Project\Member */
         $name = $baseMember->getName();
         if (!$challenger->has($name) && !$this->mustSkip($baseMember, null)) {
             $difference = new Difference('member has been removed');
             $this->populateDifference($difference, $baseMember);
             if ('private' !== $baseMember->getVisibility()) {
                 $difference->addTag(Difference::BC_BREAK);
             }
             $this->differences->add($difference);
         }
     }
     $memberComparator = new MemberComparator();
     $memberComparator->setDifferences($this->differences);
     foreach ($challenger as $challengerMember) {
         /* @var $challengerMember \RenanBr\PhpAct\Project\Member */
         $name = $challengerMember->getName();
         if ($base->has($name)) {
             $baseMember = $base->get($name);
             if (!$this->mustSkip($baseMember, $challengerMember)) {
                 $memberComparator->compare($baseMember, $challengerMember);
             }
         } else {
             if (!$this->mustSkip(null, $challengerMember)) {
                 $difference = new Difference('member has been added');
                 $this->populateDifference($difference, $challengerMember);
                 $this->differences->add($difference);
             }
         }
     }
 }
Exemple #2
0
 /**
  * @dataProvider typeProvider
  */
 public function testType($expected, $name)
 {
     self::assertEquals($expected, self::$members->get($name)->getType());
 }