fix incomplete tests while updating snapshots

This commit is contained in:
Fabio Ivona
2023-08-01 17:13:15 +02:00
parent 2f6b99885e
commit 4e719214c6
3 changed files with 32 additions and 2 deletions

View File

@ -189,7 +189,29 @@ final class TestCaseFactory
private static \$__filename = '$filename';
private array \$__snapshotChanges = [];
$methodsCode
/** @postCondition */
protected function __MarkTestIncompleteIfSnapshotHaveChanged(): void
{
if (empty(\$this->__snapshotChanges)) {
return;
}
if (count(\$this->__snapshotChanges) === 1) {
\$this->markTestIncomplete(\$this->__snapshotChanges[0]);
return;
}
\$formattedMessages = implode(PHP_EOL, array_map(function (string \$message) {
return "- \$message";
}, \$this->__snapshotChanges));
\$this->markTestIncomplete(\$formattedMessages);
}
}
PHP;