45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
When a test fails due, for example, to infrastructure issues, you might want to ignore it temporarily. But without some kind of notation about why the test is being ignored, it may never be reactivated. Such tests are difficult to address without comprehensive knowledge of the project, and end up polluting their projects.
|
|
|
|
|
|
This rule raises an issue on each test that is marked as incomplete or skipped without a message explaining the reasoning behind it.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
protected function setUp() {
|
|
if (!extension_loaded('mysqli')) {
|
|
$this->markTestSkipped(); // Noncompliant
|
|
}
|
|
}
|
|
|
|
public function testSomething()
|
|
{
|
|
$this->assertTrue($result->isValid());
|
|
$this->markTestIncomplete(); // Noncompliant
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
protected function setUp() {
|
|
if (!extension_loaded('mysqli')) {
|
|
$this->markTestSkipped( 'The MySQLi extension is not available.' ); // Compliant
|
|
}
|
|
}
|
|
|
|
public function testSomething()
|
|
{
|
|
$this->assertTrue($result->isValid());
|
|
$this->markTestIncomplete( 'Testing result validation is incomplete.' ); // Compliant
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|