Ir al contenido

Test Method Naming (ARCH7008)

Esta página aún no está disponible en tu idioma.

Key php.naming.test-name-convention · Severity info · Category naming

Test methods should follow the framework’s discovery convention; in PHPUnit that is a test prefix or the @test/#[Test] attribute. Otherwise tests are not collected by the runner and read inconsistently.

<?php
class CalculatorTest extends TestCase
{
public function checkAddition(): void
{
$this->assertSame(4, 2 + 2);
}
}
<?php
class CalculatorTest extends TestCase
{
public function testAddition(): void
{
$this->assertSame(4, 2 + 2);
}
}

Name the test method with a test prefix or mark it with the #[Test] attribute.