Write tests to cover 100% code - this is what we should try to achieve. But I came across a situation where I do not know how to test a method (factory method):
public function getDocument(){
$document = new Document();
$document->settings(new Settings());
$document->filesystem(new Filesystem('e:'));
return $document;
}
The purpose of this method is a shortcut to create a document, 3 lines are written each time.
How to check this method?
Or maybe this is the situation, why do we have a @codeCoverageIgnoreStart block? For this reason, PHPUnit provides this kind of annotation.
EDIT: The main idea of this method is to make life easier for the client. Nothing more, no configuration, etc. (But the method will be a good place for this).
$document = new Document(new Settings(), new Filesystem());
$document = Files.getDocument()
$document = new Document(new Settings(),new Filesystem('e:'));
Perhaps I should think about whether I really need to provide this method, the user who wants to use the document should know about the dependencies, he should not hide.