public function testItIsFalseWhenNothingChanged()
 {
     $test = new BodyChanged();
     $func = new ClassMethod('some_method');
     $class = new Class_('the_class');
     $class->namespacedName = $class->name;
     $func->setAttribute('parent', $class);
     $old = $func;
     $new = $func;
     $this->assertFalse($test->handle($func, $old, $new));
 }
 public function testItContainsAMessageWhenReturnTypeChanged()
 {
     $test = new ReturnTypeChanged();
     $old = new ClassMethod('foo');
     $old->returnType = 'void if seal is broken';
     $class = new Class_('the_class');
     $class->namespacedName = $class->name;
     $old->setAttribute('parent', $class);
     $test->handle($old, new ClassMethod('foo'));
     $this->assertContains('changed return type', $test->lastException->getMessage());
 }
 /**
  * @param ClassMethod $node
  * @param Doc         $docComment
  */
 private function reapplyModifiedNode(ClassMethod $node, Doc $docComment)
 {
     $attributes = $node->getAttributes();
     $comments = isset($attributes['comments']) ? $attributes['comments'] : [];
     $lastComment = count($comments) ? $comments[count($comments) - 1] : null;
     if (!$lastComment instanceof Doc) {
         $comments[] = $docComment;
     } else {
         $comments[count($comments) - 1] = $docComment;
     }
     $node->setAttribute('comments', $comments);
 }
 public function testItReturnTrueWhenReturnTypeRemoved()
 {
     $test = new ReturnTypeRemoved();
     $old = new ClassMethod('foo');
     $old->returnType = 'void if seal is broken';
     $class = new Class_('the_class');
     $class->namespacedName = $class->name;
     $old->setAttribute('parent', $class);
     $new = new ClassMethod('foo');
     $this->assertTrue('' == (string) $new->getReturnType());
     $this->assertTrue($test->handle($old, $new));
 }
 public function testItContainsErrorMessageWhenSubjectNotFound()
 {
     $test = new IsRemoved();
     $func = new ClassMethod('some_method');
     $class = new Class_('the_class');
     $class->namespacedName = $class->name;
     $func->setAttribute('parent', $class);
     $old = $func;
     $new = null;
     $this->assertTrue($test->handle($old, $new));
     $this->assertTrue($test->isTriggered());
     $this->assertInstanceOf('PHPSemVer\\Constraints\\FailedConstraint', $test->lastException);
     $this->assertEquals('the_class::some_method() removed', $test->lastException->getMessage());
 }