class TestClassClassMetadataTest
Same name and namespace in other branches
- 11.x core/tests/PHPStan/tests/TestClassClassMetadataTest.php \Drupal\PHPStan\Tests\TestClassClassMetadataTest
Tests TestClassClassMetadata rule.
@extends RuleTestCase<TestClassClassMetadata>
Attributes
#[Group('PHPStan')]
Hierarchy
- class \Drupal\PHPStan\Tests\TestClassClassMetadataTest extends \PHPStan\Testing\RuleTestCase
Expanded class hierarchy of TestClassClassMetadataTest
File
-
core/
tests/ PHPStan/ tests/ TestClassClassMetadataTest.php, line 20
Namespace
Drupal\PHPStan\TestsView source
class TestClassClassMetadataTest extends RuleTestCase {
/**
* {@inheritdoc}
*/
protected function getRule() : Rule {
return new TestClassClassMetadata(self::getContainer()->getByType(ReflectionProvider::class));
}
/**
* {@inheritdoc}
*/
public function testRule() : void {
$this->analyse([
__DIR__ . '/../fixtures/test-classes-with-metadata.php',
], [
[
'Abstract test class Drupal\\Tests\\Core\\Foo\\BarTest must not add attribute PHPUnit\\Framework\\Attributes\\RunTestsInSeparateProcesses.',
17,
],
[
'Abstract test class Drupal\\Tests\\Core\\Foo\\BarTest must not add annotation @group.',
17,
],
[
'Abstract test class Drupal\\Tests\\Core\\Foo\\BarTest must not add annotation @coversNothing.',
17,
],
[
'Test class Drupal\\Tests\\Core\\Foo\\ConcreteWithAnnotationTest must not add annotation @group.',
35,
],
[
'Test class Drupal\\Tests\\Core\\Foo\\ConcreteWithAnnotationTest must have attribute \\PHPUnit\\Framework\\Attributes\\Group.',
35,
],
]);
// This is in a separate file to avoid autoloading the classes in the test
// fixture.
$this->analyse([
__DIR__ . '/../fixtures/test-classes-missing-attributes.php',
], [
[
'Test class Drupal\\Tests\\Core\\Foo\\MissingAttributes must have attribute \\PHPUnit\\Framework\\Attributes\\RunInSeparateProcesses.',
18,
],
[
'Test class Drupal\\Tests\\Core\\Foo\\MissingAttributes must have attribute \\PHPUnit\\Framework\\Attributes\\Group.',
18,
],
[
'Test class Drupal\\Tests\\Core\\Foo\\MissingGroup must have attribute \\PHPUnit\\Framework\\Attributes\\Group.',
21,
],
[
'Test class Drupal\\Tests\\Core\\Foo\\MissingRunTestsInSeparateProcesses must have attribute \\PHPUnit\\Framework\\Attributes\\RunInSeparateProcesses.',
25,
],
]);
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| TestClassClassMetadataTest::getRule | protected | function | |
| TestClassClassMetadataTest::testRule | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.