class TestClassMethodMetadataTest

Tests TestClassMethodMetadata rule.

@extends RuleTestCase<TestClassMethodMetadata>

Attributes

#[TestDox('Check method-level test metadata')]

Hierarchy

Expanded class hierarchy of TestClassMethodMetadataTest

File

core/tests/PHPStan/tests/TestClassMethodMetadataTest.php, line 21

Namespace

Drupal\PHPStan\Tests
View source
class TestClassMethodMetadataTest extends RuleTestCase {
  
  /**
   * {@inheritdoc}
   */
  protected function getRule() : Rule {
    return new TestClassMethodMetadata(self::getContainer()->getByType(ReflectionProvider::class), self::getContainer()->getByType(FileTypeMapper::class));
  }
  
  /**
   * {@inheritdoc}
   */
  public function testRule() : void {
    $this->analyse([
      __DIR__ . '/../fixtures/test-methods-with-metadata.php',
    ], [
      [
        'Test method testWithAttributeAndForbiddenAnnotation must not add annotation @group.',
        21,
      ],
      [
        'Test method testWithForbiddenAnnotation must not add annotation @group.',
        35,
      ],
      [
        'Test method testInTraitWithAttributeAndForbiddenAnnotation must not add annotation @group.',
        69,
      ],
      [
        'Test method testInTraitWithForbiddenAnnotation must not add annotation @group.',
        83,
      ],
    ]);
  }

}

Members

Title Sort descending Modifiers Object type Summary
TestClassMethodMetadataTest::getRule protected function
TestClassMethodMetadataTest::testRule public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.